Latest Update causing issues "SQLITE_ERROR: table "temporary user" already exists"

Hi there,

I just tried to update an n8n instance I am running on Digital Ocean droplet. The URL where I run the page is now showing as bad gateway or 404 not found.

I checked the logs of the n8n instance and I am getting

Stopping n8n…
Initializing n8n process
Migrations in progress, please do NOT stop the process.
There was an error initializing DB: “SQLITE_ERROR: table “temporary_user” already exists”

which just repeats and repeats. Any ideas on how I can get this working again? My technical skills are fairly limited but I am happy to try anything. I was using this for quite some processes so the downtime is super unfortunate.

Thanks for any and all help!

Hi @stuart, I am sorry to hear you’re having trouble.

This sounds like a previous database migration might have been interrupted and now the migration fails because a command (presumably this one) fails to run.

One option to recover would be to:

  1. Stop n8n
  2. Export your current workflows and credentials using the CLI (documented here)
  3. Move the old database file (usually lives in ~\.n8n\database.sqlite) to a new location (you could also delete it, but it could be good to have a backup just in case)
  4. Start n8n again (which will create a new database file)
  5. Import your workflows and credentials using the CLI
  6. Restart n8n, make sure all required workflows are active

If you know which previous migration failed and you have backups from before that time, you could also consider recovering a backup and then simply re-running the upgrade without interrupting the migration.

Lastly, you could also try manually deleting the temporary_user table from your database and then restart n8n, but make sure to take a backup before changing the db.

Thank you, remaking the database and keeping the backup worked. Appreciate the guidelines to follow :slight_smile:

1 Like

Sweet, glad to hear this worked! Thanks so much for confirming :bowing_man: