Workflow import fails after upgrade to v1.123.6 due to activeVersionId / foreign key constraints

Workflow imports fail on n8n v1.123.6 and later, even when importing into a brand-new instance with no existing workflows.

This issue started appearing after upgrading from v1.110.1 → v1.123.6 and seems to be related to changes in how active workflow versions are handled.

We heavily rely on exporting and importing workflows for migrations and environment setup, and this regression breaks that flow.

An error occurred while importing workflows. See log messages for details.
SQLITE_CONSTRAINT: FOREIGN KEY constraint failed
SQLITE_CONSTRAINT: FOREIGN KEY constraint failed

We currently work with Exporting and Importing Workflows and Starting seeing this errors due to new active versions

Manually modifying the exported workflow JSON to:

  • Set activeVersionId to null

  • Set active to false

allows the import to succeed.

Information on your n8n setup

  • n8n version: >= 1.123.6
  • Database (default: SQLite)
  • n8n EXECUTIONS_PROCESS setting (default: own, main) :main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker and npm
  • Operating system: Ubuntu

@Jon Could you please help on this, On Some domains the workflow activation are failing, as activeVersionId is null, the workflow_history and workflow_publish_history don’t get populated, and if i set the activeVersionId, i get the above error.

hey @Roney_Dsilva,

I think this is fixed, look at this topic:

I upgraded to the latest version, tried doing the same on 2.3.2, got a different error now,
n8n import:workflow --separate --input=/home/roney/Workspace/public_html/repo/workflows
Importing 77 workflows…
An error occurred while importing workflows. See log messages for details.
Timeout waiting for lock SqliteWriteConnectionMutex to become available
Timeout waiting for lock SqliteWriteConnectionMutex to become available

same happens on clean DB Aswell. SQlite and Postgres aswell.

I verified that the exports are having versionId and activeVersionId

Am i the only person facing the issue?? can someone else also try please

Could not remove webhooks of workflow "zpZdHBVeS2X80V4Q" because of error: "Could not find workflow"
Could not find workflow
Error: Could not find workflow
    at ActiveWorkflowManager.clearWebhooks (/home/roney/.nvm/versions/node/v22.18.0/lib/node_modules/n8n/src/active-workflow-manager.ts:244:10)
    at ActiveWorkflowManager.remove (/home/roney/.nvm/versions/node/v22.18.0/lib/node_modules/n8n/src/active-workflow-manager.ts:872:4)
    at ImportService.importWorkflows (/home/roney/.nvm/versions/node/v22.18.0/lib/node_modules/n8n/src/services/import.service.ts:84:5)
    at ImportWorkflowsCommand.run (/home/roney/.nvm/versions/node/v22.18.0/lib/node_modules/n8n/src/commands/import/workflow.ts:104:3)
    at CommandRegistry.execute (/home/roney/.nvm/versions/node/v22.18.0/lib/node_modules/n8n/src/command-registry.ts:83:4)
    at /home/roney/.nvm/versions/node/v22.18.0/lib/node_modules/n8n/bin/n8n:63:2

Could not remove webhooks of workflow "zyVNHpgKCBO7Blp4" because of error: "Could not find workflow"
An error occurred while importing workflows. See log messages for details.
Timeout waiting for lock SqliteWriteConnectionMutex to become available
Timeout waiting for lock SqliteWriteConnectionMutex to become available

For clean setup i get above. even when the workflows were exported from 2.3.2 aswell

I see the Issue is fixed now in 2.3.4 Release [email protected] · n8n-io/n8n · GitHub.
wasted 4 days on this trying to fix with workarounds :smiling_face_with_tear:

1 Like