Problem setting up owner Request failed with status code 401 after upgrade

Describe the problem/error/question

I installed n8n with npm a few months ago and all was running well. Decided to do an upgrade to the latest version and now I can’t get back in. I have read various different solutions here and I am still unable to get in. I have used the CLI to export all of my workflows and credentials.

What I have tried

  1. Password reset - never got an email
  2. User Mgt reset on CLI - n8n user-management:reset
  3. Set up new owner - gives me the problem setting up owner message
  4. Edit user table in DB and set password - Reset user n8n docker
  5. Move DB and config file to backup folder and have n8n create new DB and config file
  6. Tried setting up new owner so I could import the old workflows. 401 error

I have restarted n8n between steps.

What is the error message (if any)?

  1. Problem setting up owner Request failed with status code 401
  2. As I have reset the user it can’t find user to send new email

Information on your n8n setup

  • n8n version: n8n/0.222.3 linux-x64 node-v14.21.3
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • Operating system: Ubuntu 20.04 LTS x64

Hi @Don_Shine - welcome to the community! :tada:

This is an interesting one - I just tested it myself, and had no issues setting a new owner. In fact, your step number 5 of having n8n create a new DB and config file should have done the trick.

A couple of things I could think of:

  1. Are you using any special characters in the email or password which we might have missed and accidentally consider invalid? You can verify this by trying to use just Latin letters and numbers, if you aren’t already.
  2. Are you seeing the same behaviour with Node.js 16? This is the Node.js version used by the n8n Docker image, but you appear to be using Node.js 14. This could be causing it.

Let me know if this helps!

Hi @EmeraldHerald.

Thank you for the response.

  1. not using any special characters
  2. I was able to get it working with the current version of Node.

Solution (of sorts)

  1. use the command line to export workflows
n8n export:workflow --all --output=backups/latest/workflows.json
  1. use the command line to export credentials
n8n export:credentials --all --decrypted --output=backups/decrypted.json
  1. move the n8n folder so I had a backup
mv .n8n .n8n_backup
  1. Did a fresh install
npm install n8n -g
  1. Created a new user via the browser
  2. Navigate to the n8n_backup folder and import the data.
n8n import:workflow --input=backups/latest/workflows.json
n8n import:credentials --input=backups/decrypted.json

This get all my workflow back in but I lost the history for the previous workflows. This is not important for me but it may be important for others.

P.S. Thank you for an amazing product. I keep finding more uses for it :slight_smile:


Thank you for the kind words, and for sharing such a detailed solution to your problem!

1 Like

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