Error while importing topics from Flarum (users, groups import OK)

oshyan
Fri, 03 Sep 2021 02:06:43 +0000
Migration

Hey folks, I’m really hoping someone can help me out with a Flarum to Discourse migration I’m working on. I’ve hacked my way through a huge amount of missing knowledge on my part, and solved a couple of errors based on assumptions the current importer appears to make (e.g. database prefixes). After all that I was able to get both Categories and Users imported!

But now I’m running into problems getting the actual Topics in, which are of course one of the most important things. And unfortunately I’m finding very little on the specific error message I am getting. There is one older topic here in Meta that never got a response, so no help there. I’m hopeful I can fare better.

Here’s the full error message. The part near the bottom seems to be the pointy end. The “duplicate key value” that’s identified really seems vague, so I’m stuck. Thanks in advance for any insight you can provide!

An error occurred while loading ./script/import_scripts/flarum_import.rb.
Failure/Error: return exec_without_profiling(*args, &blk) unless SqlPatches.should_measure?

PG::InFailedSqlTransaction:
  ERROR:  current transaction is aborted, commands ignored until end of transaction block
# ./script/import_scripts/base.rb:243:in `ensure in block in all_records_exist?'
# ./script/import_scripts/base.rb:243:in `block in all_records_exist?'
# ./script/import_scripts/base.rb:224:in `all_records_exist?'
# ./script/import_scripts/flarum_import.rb:122:in `block in import_posts'
# ./script/import_scripts/base.rb:874:in `block in batches'
# ./script/import_scripts/base.rb:873:in `loop'
# ./script/import_scripts/base.rb:873:in `batches'
# ./script/import_scripts/flarum_import.rb:101:in `import_posts'
# ./script/import_scripts/flarum_import.rb:32:in `execute'
# ./script/import_scripts/base.rb:47:in `perform'
# ./script/import_scripts/flarum_import.rb:162:in `<top (required)>'
# ------------------
# --- Caused by: ---
# PG::UniqueViolation:
#   ERROR:  duplicate key value violates unique constraint "import_ids_pkey"
#   DETAIL:  Key (val)=(3) already exists.
#   ./script/import_scripts/base.rb:231:in `block in all_records_exist?'
No examples found.


Finished in 0.00004 seconds (files took 5.56 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples

4 posts - 2 participants