I am self hosting N8N in docker and it defaults to using SQLite. After playing a bit, I thought it would be time to upgrade so i added the postgres service to my compose file and do the CLI command to export the entities, workflow, and credentials CLI Commands.
If I understand correctly, I should be able to use just the entities as it contains all the data inside my n8n. So after exporting the entities, I remove my container, reconfigured the compose, starts the container, and run the n8n import:entities --inputDir ./outputs --truncateTables true
Then I had my first error which is duplicate key value violates unique constraint “pk_workflows_tags”. After researching a bit I found out that the entities.zip contains “workflows_tags.jsonl” and “workflowtagmapping.jsonl”. I removed the “workflowtagmapping.jsonl” from the zip file and run the import command again.
It succeeds and I can see all my workflows, credentials, execution, users, etc. However, I am not able to run a single workflow manually. Whenever I tried, I got the error “Problem running workflow : There is already an entry with this name”.
the “entry with this name” error usually means schema constraints got messed up during import, even tho it says success. before reimporting everything, try exporting just one workflow from SQLite and importing that single one to postgres. if that one workflow runs fine but the bulk import fails, you’ve got a data shape issue. if even the single one fails, theres a schema mismatch.
I am self hosting N8N in docker and it defaults to using SQLite. After playing a bit, I thought it would be time to upgrade so i added the postgres service to my compose file and do the CLI command to export the entities, workflow, and credentials CLI Commands.
If I understand correctly, I should be able to use just the entities as it contains all the data inside my n8n. So after exporting the entities, I remove my container, reconfigured the compose, starts the container, and run the n8n import:entities --inputDir ./outputs --truncateTables true
Then I had my first error which is duplicate key value violates unique constraint “pk_workflows_tags”. After researching a bit I found out that the entities.zip contains “workflows_tags.jsonl” and “workflowtagmapping.jsonl”. I removed the “workflowtagmapping.jsonl” from the zip file and run the import command again.
It succeeds and I can see all my workflows, credentials, execution, users, etc. However, I am not able to run a single workflow manually. Whenever I tried, I got the error “Problem running workflow : There is already an entry with this name”.
did you get a chance to try the single workflow test i mentioned? export just one workflow from sqlite and import it standalone on postgres — if that one runs fine but the bulk import doesnt, its almost certainly a data ordering or constraint issue in the entities export rather than a schema problem
Just get back on it and i noticed all the issues are gone. I didn’t do a single thing after posting this thread. I’ve checked most of the features such as running workflow manually, creating credentials, checking execution data, etc and it seems to be working normally now.
Not sure if this is solved due to the container restarting as i’m hosting it on my laptop which means it will turned down when i shutdown my laptop. Truly grateful for your help and suggestions, thanks
glad it sorted itself out! the container restart likely flushed some stale connection state or postgres sequence counters that were out of sync after the bulk import. worth keeping in mind — a clean restart after a heavy import is a good habit anyway. happy it’s all working now