# Error Importing Categories from a Discourse Instance to Another

**URL:** https://meta.discourse.org/t/error-importing-categories-from-a-discourse-instance-to-another/218090
**Category:** Support
**Created:** [February 14, 2022, 5:12am UTC](https://meta.discourse.org/t/error-importing-categories-from-a-discourse-instance-to-another/218090 "2022-02-14T05:12:52Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![hyphalos](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hyphalos](https://meta.discourse.org/u/hyphalos)
#### Post date: [February 14, 2022, 5:12am UTC](https://meta.discourse.org/t/error-importing-categories-from-a-discourse-instance-to-another/218090/1 "2022-02-14T05:12:52Z")

</div>

Hi Discourse team!

I’m running into an error when I tried to export a category from our staging environment to our production. For context we have a bunch of topics in staging that we wish to publish on production and copy-pasting would take a long time.

Here is the error I run into after running `discourse import_category category-export-2022-02-14-042606.json` based off [this tutorial](https://meta.discourse.org/t/topic-and-category-export-import/38930):

```plaintext
Starting import from category-export-2022-02-14-042606.json...
Importing users...
Importing groups...
bundler: failed to load command: script/discourse (script/discourse)
Traceback (most recent call last):
	42: from /usr/local/bin/bundle:25:in `<main>'
	41: from /usr/local/bin/bundle:25:in `load'
	40: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/exe/bundle:36:in `<top (required)>'
	39: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
	38: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/exe/bundle:48:in `block in <top (required)>'
	37: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/lib/bundler/cli.rb:25:in `start'
	36: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	35: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/lib/bundler/cli.rb:31:in `dispatch'
	34: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	33: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	32: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	31: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/lib/bundler/cli.rb:484:in `exec'
	30: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/lib/bundler/cli/exec.rb:23:in `run'
	29: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/lib/bundler/cli/exec.rb:58:in `kernel_load'
	28: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/lib/bundler/cli/exec.rb:58:in `load'
	27: from script/discourse:290:in `<top (required)>'
	26: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
	25: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	24: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	23: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	22: from script/discourse:243:in `import_category'
	21: from /var/www/discourse/lib/import_export.rb:15:in `import'
	20: from /var/www/discourse/lib/import_export/importer.rb:25:in `perform'
	19: from /var/www/discourse/lib/import_export/importer.rb:61:in `import_groups'
	18: from /var/www/discourse/lib/import_export/importer.rb:61:in `each'
	17: from /var/www/discourse/lib/import_export/importer.rb:65:in `block in import_groups'
	16: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/persistence.rb:55:in `create!'
	15: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/suppressor.rb:48:in `save!'
	14: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/transactions.rb:302:in `save!'
	13: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/transactions.rb:350:in `with_transaction_returning_status'
	12: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `transaction'
	11: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction'
	10: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
	 9: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
	 8: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
	 7: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
	 6: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
	 5: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'
	 4: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `block in transaction'
	 3: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/transactions.rb:354:in `block in with_transaction_returning_status'
	 2: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/transactions.rb:302:in `block in save!'
	 1: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/validations.rb:53:in `save!'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/validations.rb:80:in `raise_validation_error': Validation failed: You cannot allow membership requests for a group without any owners. (ActiveRecord::RecordInvalid)

```

I only wish to export the category, so I’m not sure what it’s complaining about the groups.

Any help would be greatly appreciated!

Cheers,  
Tim

---

<div class="post-metadata">

### Author: ![hyphalos](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hyphalos](https://meta.discourse.org/u/hyphalos)
#### Post date: [February 16, 2022, 12:24am UTC](https://meta.discourse.org/t/error-importing-categories-from-a-discourse-instance-to-another/218090/2 "2022-02-16T00:24:29Z")

</div>

Just bumping and seeing if anyone else has experienced this issue?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [February 16, 2022, 1:02am UTC](https://meta.discourse.org/t/error-importing-categories-from-a-discourse-instance-to-another/218090/3 "2022-02-16T01:02:23Z")

</div>

I think that the script tries to import everything.

You might see if you can edit the group out of the json or modify the script to skip the group.

---

<div class="post-metadata">

### Author: ![hyphalos](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hyphalos](https://meta.discourse.org/u/hyphalos)
#### Post date: [February 16, 2022, 10:34pm UTC](https://meta.discourse.org/t/error-importing-categories-from-a-discourse-instance-to-another/218090/5 "2022-02-16T22:34:47Z")

</div>

Hi @pfaffman ,

Thanks for your response!

What do you mean by _everything_? I’ll give that a go and edit the groups out of the json. I thought the tutorial was only for categories / topics so I didn’t expect it to give me a lot more than that

Will report back once I test it!

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [February 16, 2022, 11:50pm UTC](https://meta.discourse.org/t/error-importing-categories-from-a-discourse-instance-to-another/218090/6 "2022-02-16T23:50:28Z")

</div>

> [@hyphalos](#):
>
> I thought the tutorial was only for categories / topics so I didn’t expect it to give me a lot more than that

It’s a slippery slope. You can’t create the topics without the users, and then on it goes.
