{"record":{"id":"fa1dbf401a09c458","repo":"n8n-io/n8n","slug":"the-activestate-fromjson-flag-can-only-be-used","errorCode":null,"errorMessage":"The \"--activeState=fromJson\" flag can only be used when n8n is running in queue or multi-main mode. In regular deployment mode, workflow activation is not supported.","messagePattern":"The \"--activeState=fromJson\" flag can only be used when n8n is running in queue or multi-main mode\\. In regular deployment mode, workflow activation is not supported\\.","errorType":"exception","errorClass":"UserError","httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/import/workflow.ts","lineNumber":108,"sourceCode":"@Command({\n\tname: 'import:workflow',\n\tdescription: 'Import workflows',\n\texamples: [\n\t\t'--input=file.json',\n\t\t'--separate --input=backups/latest/',\n\t\t'--input=file.json --userId=1d64c3d2-85fe-4a83-a649-e446b07b3aae',\n\t\t'--input=file.json --projectId=Ox8O54VQrmBrb4qL',\n\t\t'--separate --input=backups/latest/ --userId=1d64c3d2-85fe-4a83-a649-e446b07b3aae',\n\t\t'--input=file.json --activeState=fromJson',\n\t],\n\tflagsSchema,\n})\nexport class ImportWorkflowsCommand extends BaseCommand<z.infer<typeof flagsSchema>> {\n\tasync run(): Promise<void> {\n\t\tconst { flags } = this;\n\n\t\tif (flags.activeState === 'fromJson' && this.globalConfig.executions.mode !== 'queue') {\n\t\t\tthrow new UserError(\n\t\t\t\t'The \"--activeState=fromJson\" flag can only be used when n8n is running in queue or multi-main mode. In regular deployment mode, workflow activation is not supported.',\n\t\t\t);\n\t\t}\n\n\t\tif (!flags.input) {\n\t\t\tthis.logger.info('An input file or directory with --input must be provided');\n\t\t\treturn;\n\t\t}\n\n\t\tif (flags.separate) {\n\t\t\tif (fs.existsSync(flags.input)) {\n\t\t\t\tif (!fs.lstatSync(flags.input).isDirectory()) {\n\t\t\t\t\tthis.logger.info('The argument to --input must be a directory');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/cli/src/commands/import/workflow.ts#L90-L126","documentation":"Thrown by `import:workflow` when `--activeState=fromJson` is passed but n8n is not running in queue execution mode. The fromJson option respects each workflow's `active` field on import, which requires the queue/worker (multi-main) architecture because activation triggers the active workflow registry — not available in regular single-process mode.","triggerScenarios":"`n8n import:workflow --input=f.json --activeState=fromJson` while `EXECUTIONS_MODE=regular` (the default) in the global config. The check at workflow.ts:107 reads `this.globalConfig.executions.mode`.","commonSituations":"Trying to preserve activation state during import on a local dev instance running in regular mode; env var N8N_EXECUTIONS_MODE not set to 'queue'.","solutions":["Set `N8N_EXECUTIONS_MODE=queue` (and run Redis + a worker) before importing.","Drop `--activeState=fromJson` to import all workflows as inactive (the default 'false' behaviour).","After import in regular mode, activate workflows manually through the UI."],"exampleFix":"// before — regular mode\nn8n import:workflow --input=f.json --activeState=fromJson\n// after — either run in queue mode, or drop the flag\nN8N_EXECUTIONS_MODE=queue n8n start  # then import\n// or\nn8n import:workflow --input=f.json  # imports inactive","handlingStrategy":"validation","validationCode":"function canUseFromJson(globalConfig: { executions: { mode: string } }): boolean {\n  return globalConfig.executions.mode === 'queue';\n}\nif (flags.activeState === 'fromJson' && !canUseFromJson(globalConfig)) {\n  throw new Error('--activeState=fromJson requires N8N_EXECUTIONS_MODE=queue');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await execN8n(['import:workflow', '--input', f, '--activeState=fromJson']);\n} catch (e) {\n  if (e.message.includes('--activeState=fromJson')) {\n    // not in queue mode — fall back\n    await execN8n(['import:workflow', '--input', f]);\n  } else throw e;\n}","preventionTips":["Only request --activeState=fromJson in queue-mode deployments.","In regular mode, activate workflows post-import through the UI or API."],"tags":["cli","import","workflow","queue-mode","activation","config","user-error"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}