Problem setting up Owner 401

Describe the issue/error/question

I have swapped to a different machine recently, however, when starting n8n locally I repeatedly get 401 on almost every action.
When setting up the Owner account it gives me a 401.

Problem setting up owner
Request failed with status code 401

If I skip setting up an owner, I won’t be able to create any workflow as it prompts 401 and a never ending loading screen when I click on Workflows/New

Init Problem

There was a problem loading init data:
*Request failed with status code 401*

When I click on Workflows/Open, I also get the following:


Problem loading workflows
Request failed with status code 401

Could not load active workflows
Request failed with status code 401

What could be the cause of this ?

Information on n8n setup

  • n8n version: 0.173.1
  • Database : SQLite
  • Running n8n via npm

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

Could you upgrade to n8n version 0.180.0 or later? You should then hopefully be able to use the user-management:reset CLI command to reset your user management data and set up an owner as expected.

is it n8n user-management:reset ?

Yes, you should get an output like Successfully reset the database to default user state. when running this command:

image

Might also be worth restarting the app afterwards and clearing your browser cache & cookies, just tobe on the safe side.

1 Like

It seems that I had accidentally run install, bootstrap, or build with node18 at some stage.
The problem is resolved after I cleaned up everything and redo them with my nvm set to node 16.

2 Likes

Hello I have realised this issue only occurs when using Safari (running locally with rpm), however, the exact same code works perfectly fine with docker.

The only errors I got in console were
TypeError: this.getSearchedWorkflows is not a function. (In 'this.getSearchedWorkflows(this.query)', 'this.getSearchedWorkflows' is undefined)
and the rest being 401

Hello, I also encountered this problem.
using n8n 1.1.1 on k8s with default sqlite
I’ve tried
n8n user-management:reset

I can set up new account successfully, but after login, the workflow page still shows:
Init problem:
There was a problem loading init data:
Request failed with status code 401

Besides, I also encountered “Connection lost” problem after I bind a domain to access it.

Hey @dolphinseu,

Welcome to the community :raised_hands:

Are you going direct to your n8n instances IP or through the domain? If you are going through the domain have you configured your reverse proxy to allow websockets?

Hello, I also encountered this problem :
(On FireFox, Chrome, Opera)

Problem setting up owner

Request failed with status code 401

I don’t understand where and how to reset user-management if this can solved the problem.

Information on n8n setup

  • n8n version: 1.29.1
  • Database : SQLite
  • Running: n8n via Docker on Synology DS920+
1 Like

I have the same problem. Did you manage to solve it?

No, I try to add SMTP defines, no change.

You shouldn’t need to set up SMTP for this to work. Are you using a reverse proxy to access n8n or accessing n8n directly with the IP?

i’m using the Coolify, it generate for a me a link.

I am also having this problem. Accessing straight via IP

Information on n8n setup

  • n8n version: 1.31.1
  • Database : Postgres
  • Running: n8n via Docker
docker logs -f d5ddb52dffd7
User settings loaded from: /home/node/.n8n/config
Initializing n8n process
n8n ready on 0.0.0.0, port 5678
Version: 1.31.1

Editor is now accessible via:
http://localhost:5678/

Version 1.31.0 succeed to creating owner account

3 Likes

Got the same problem. First time trying n8n

I installed it with Docker, using the Docker Compose image available at

got the error 401

Changed docker compose to
version: “3.7”

services:
n8n:
image: docker.n8n.io/n8nio/n8n
restart: always
ports:
- “5678:5678”
environment:
- N8N_HOST=192.168.0.95
- N8N_PORT=5678
- N8N_PROTOCOL=http
- NODE_ENV=production
- GENERIC_TIMEZONE=America/Sao_Paulo
volumes:
- n8n_data:/home/node/.n8n

volumes:
n8n_data:
external: true

Still error 401.

Are you accessing your n8n instance over HTTP or HTTPS? If you are using HTTP you may see this issue and it would be worth trying to set the N8N_SECURE_COOKIE env option to false and seeing if that helps.

3 Likes

Thank you, that helped!

root@n8n:~# export N8N_SECURE_COOKIE=false
root@n8n:~# n8n start
User settings loaded from: /root/.n8n/config
Initializing n8n process
n8n ready on 0.0.0.0, port 5678
Version: 1.31.2

Editor is now accessible via:
http://localhost:5678/

Press "o" to open in Browser.
Owner was set up successfully
User survey updated successfully
1 Like

This working for me, using IP address only:


version: "3.7"

services:
  caddy:
    image: caddy:latest
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - caddy_data:/data
      - ${DATA_FOLDER}/caddy_config:/config
      - ${DATA_FOLDER}/caddy_config/Caddyfile:/etc/caddy/Caddyfile

  n8n:
    image: docker.n8n.io/n8nio/n8n
    restart: always
    ports:
      - 5678:5678
    environment:
      - N8N_HOST=${DOMAIN_NAME}
      - N8N_PORT=5678
      - N8N_PROTOCOL=http
      - NODE_ENV=production
      - WEBHOOK_URL=http://${DOMAIN_NAME}/
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
      - N8N_SECURE_COOKIE=false
    volumes:
      - n8n_data:/home/node/.n8n
      - ${DATA_FOLDER}/local_files:/files

volumes:
  caddy_data:
    external: true
  n8n_data:
    external: true

Hey @Nicolas_Dev,

If you are using Caddy it would handle ssl for you so you could access it that way if you have a domain configured.