SQLite Error when upgrading docker image: table "role" already exists

Describe the issue/error/question

When recreating the n8n image using docker-compose, I get an error on DB migration.
I have tried removing the role table, but nothing changes.

What is the error message (if any)?

There was an error initializing DB: "SQLITE_ERROR: table "role" already exists"

Information on your n8n setup

  • **n8n version:latest
  • **Database you’re using:SQLite
  • **Running n8n with the execution process:own?
  • **Running n8n via:Docker

Hey @Sorvah,

What version were you on before you tried to update? I assume that is what you were doing rather than a recreate.

It looks like a previous migration may have failed although if you have manually deleted the table it should be a different message.

Could it be something odd like the volume is not mounted correctly?

I am not sure which version it was before, but I think it was like 3 or 4 versions of difference.
I’ve tried several times removing the role and user tables, and they’re recreated each time, but the same error appears.

The volume, it’s the same as before.
I have 4 workflows, is there a way to export them (from the DB or a JSON file), remove the volume and import them again?


You could try to use the cli tool in the container, if you have the db file locally it could be worth trying to use the desktop app to see if that can load it and get the workflows out

I’ve been able to recover the workflows by exporting them from the SQLite database. However, I didn’t realize that I had some credentials as well, and unfortunately I’ve removed the DB already :frowning: I have to start my workflows over. Too bad.

The app is now running, but at a high cost.

1 Like