N8n self hosted: Cannot read properties of undefined (reading 'user')

Hello! I am having a problem after a stoped migration.

I am running n8n with docker-compose and I have a sqlite database. The pinned version for n8n is 0.189.1. I updated
the docker-compose to point to latest (1.4.0?). In the middle of the migration, I stopped the container while migration were running.
I restarted the container and let the migration finish. I am getting the following error when I try to run n8n:

Workflow could not be activated on first try, keep on trying
n8n_1 | Cannot read properties of undefined (reading ‘user’).

It seems to be a problem with user permissions. What would the best way to solve this problem?


Hi @inmobo, welcome to the community! I am very sorry you are having trouble. This seems like your workflows might not have a valid owner, presumably due to the interrupted migration.

I reckon the easiest way to resolve this would be to:

  1. Export all your workflows and credentials using the CLI
  2. Stop n8n
  3. Delete your old database.sqlite file (or better, move it out of your .n8n data directory and into a backup location just in case)
  4. Start n8n (n8n should now create a fresh database), open it in your browser and create your user account
  5. Import your workflows and credentials from step 1 using the CLI again

Hope this helps!

On another note, if you stopped the container while the migration was running because it was taking too long you might simply have too much old data. You want to look at setting up data pruning if so.

1 Like

Thank you! We’ll do that.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.