CLI Backup Import Errors

Describe the problem/error/question

My Windows npm-installed n8n suddenly failed to load modules in code despite setting all the export NODE_FUNCTION… variables. I said to heck with this, let’s just do Docker and I backed up all workflows and credentials via CLI as documentation instructs. I then wiped and reinstalled node and everything. Now, when I try to import the backup workflows + credentials, I get the following errors:

If I import a single workflow it works. However, I have very many workflows and many are linked by IDs, so having to import each one by one and reconfigure all the names/ids will be a massive waste of time. I have reinstalled n8n via node just to be sure and the same errors result. Hopefully someone can help with this, fast. Thanks!

What is the error message (if any)?

Importing 53 workflows…

An error occurred while importing workflows. See log messages for details.
Cannot read properties of undefined (reading ‘forEach’)

An error occurred while importing credentials. See log messages for details.
SQLITE_CONSTRAINT: NOT NULL constraint failed: credentials_entity.data

Note: I cannot find info in the logs about this error, despite the instruction to look for details in the log.

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • **n8n version:1.52.2
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • **Running n8n via (Docker, npm, n8n cloud, desktop app):Docker, npm
  • Operating system:

what command did you use to export the backup?

n8n export:workflow --backup --output=backups/latest/
n8n export:credentials --backup --output=backups/latest/

Anything? This is the latest of unexpected problems since I upgraded n8n version here: N8n update broke n8n api - #6 by Jonathan_Sherman

Man! Finally figured it out. Here was the issue, when running the export in accordance to documentation, the subsequent import cannot distinguish between a workflow and a credential. It breaks when trying to load a credential as a workflow and vice versa.

n8n export:workflow --backup --output=backups/latest/
n8n export:credentials --backup --output=backups/latest/

Thus, maybe you should change documentaiton to:

n8n export:workflow --backup --output=backups/latest/workflow
n8n export:credentials --backup --output=backups/latest/credentials

1 Like

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