N8n CLI workflows not activating

Describe the problem/error/question

When running
n8n update:workflow --all --active=true
I get this output:
Deactivating all workflows

What is the error message (if any)?

docker-n8n-1  | UserSettings were generated and saved to: /home/node/.n8n/config
docker-n8n-1  | Migrations in progress, please do NOT stop the process.
docker-n8n-1  | Migrations finished.
docker-n8n-1  | Successfully imported 3 credentials.
docker-n8n-1  | Importing 30 workflows...
docker-n8n-1  | Deactivating workflow "-SNIP-" during import, remember to activate it later.
docker-n8n-1  | Deactivating workflow "-SNIP-" during import, remember to activate it later.
docker-n8n-1  | Deactivating workflow "-SNIP-" during import, remember to activate it later.
docker-n8n-1  | Deactivating workflow "-SNIP-" during import, remember to activate it later.
docker-n8n-1  | Deactivating workflow "-SNIP-" during import, remember to activate it later.
docker-n8n-1  | Deactivating workflow "-SNIP-" during import, remember to activate it later.
docker-n8n-1  | Deactivating workflow "-SNIP-" during import, remember to activate it later.
docker-n8n-1  | Deactivating workflow "-SNIP-" during import, remember to activate it later.
docker-n8n-1  | Deactivating workflow "-SNIP-" during import, remember to activate it later.
docker-n8n-1  | Deactivating workflow "-SNIP-" during import, remember to activate it later.
docker-n8n-1  | Deactivating workflow "-SNIP-" during import, remember to activate it later.
docker-n8n-1  | Deactivating workflow "-SNIP-" during import, remember to activate it later.
docker-n8n-1  | Deactivating workflow "-SNIP-" during import, remember to activate it later.
docker-n8n-1  | Deactivating workflow "-SNIP-" during import, remember to activate it later.
docker-n8n-1  | Deactivating workflow "-SNIP-" during import, remember to activate it later.
docker-n8n-1  | Deactivating workflow "-SNIP-" during import, remember to activate it later.
docker-n8n-1  | Deactivating workflow "-SNIP-" during import, remember to activate it later.
docker-n8n-1  | Deactivating workflow "-SNIP-" during import, remember to activate it later.
docker-n8n-1  | Deactivating workflow "-SNIP-" during import, remember to activate it later.
docker-n8n-1  | Deactivating workflow "-SNIP-" during import, remember to activate it later.
docker-n8n-1  | Deactivating workflow "-SNIP-" during import, remember to activate it later.
docker-n8n-1  | Deactivating workflow "-SNIP-" during import, remember to activate it later.
docker-n8n-1  | Deactivating workflow "-SNIP-" during import, remember to activate it later.
docker-n8n-1  | Successfully imported 30 workflows.
docker-n8n-1  | Deactivating all workflows
docker-n8n-1  | Done
docker-n8n-1  | License manager not initialized
docker-n8n-1  | n8n ready on 0.0.0.0, port 5678
docker-n8n-1  | Initializing n8n process
docker-n8n-1  | Version: 0.233.0
docker-n8n-1  | 
docker-n8n-1  | Editor is now accessible via:
docker-n8n-1  | http://localhost:5678/

Please share your workflow

n/a - 30 workflows

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 0.233.0
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): queue
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker
  • Operating system: ubuntu

Compose file

  n8n:
    image: n8nio/n8n:0.233.0
    restart: always
    environment: 
        - EXECUTIONS_MODE=queue
        - QUEUE_BULL_REDIS_HOST=redis
        - QUEUE_HEALTH_CHECK_ACTIVE=true
        - NODE_OPTIONS="--max-old-space-size=8192"
        - GENERIC_TIMEZONE=${N8N_TIMEZONE:?timezone is not set in .env}
        - EXECUTIONS_DATA_PRUNE=true
        - EXECUTIONS_DATA_MAX_AGE=24
        - EXECUTIONS_DATA_PRUNE_MAX_COUNT=500
        - EXECUTIONS_DATA_SAVE_ON_ERROR=all
        - EXECUTIONS_DATA_SAVE_ON_SUCCESS=none
        - EXECUTIONS_DATA_SAVE_ON_PROGRESS=false
        - EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS=false
        - NODE_FUNCTION_ALLOW_BUILTIN=* 
        - NODE_FUNCTION_ALLOW_EXTERNAL=moment,crypto-js
        - PUBLIC_URL=${PUBLIC_URL}
    volumes:
        - ./data/n8n/config:/home/node/.n8n/config        
        - ./data/workflows:/workflows   #this has a bunch of workflow json files in it
        - ./data/credentials:/credentials #this has a bunch of credential json files in it
    command:
      - /bin/sh
      - -c
      - |
        /usr/local/bin/n8n import:credentials --separate --input=/credentials/ &&
        /usr/local/bin/n8n import:workflow --separate --input=/workflows/ &&
        /usr/local/bin/n8n update:workflow --all --active=true &&
        /usr/local/bin/n8n start

The same error happens both on startup, and if I run it manually in the container:

data # n8n update:workflow --all --active=true
Deactivating all workflows
Done
/data # 

Additionally, I get this error when activating them through the UI:

Workflow could not be activated:

*Request failed with status code 401*

Hi @Tim_C, I am very sorry you’re having trouble.

I was not able to reproduce the problem based on your description, but is there a chance your credentials file is encrypted or you are using n8n’s user management functionality?

If your credentials are encrypted n8n might not be able to decrypt these (unless both your source instance and your current instance have the same encryption key) and can’t use them to activate your workflows.

If you are using the user management features in n8n, are you trying to activate the workflows in question as the owner? The CLI does not account for user accounts afaik, so I reckon this could play a role here. It would be great if you could provide example files (dummy credentials/workflows without any confidential data) using which this can be verified.

Lastly, when manually running a CLI command in the container make sure to do this under the node user as documented here.

1 Like

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