n8n-io/n8n · error · UserError
The "--activeState=fromJson" flag can only be used when n8n
Error message
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.
What it means
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.
Source
Thrown at packages/cli/src/commands/import/workflow.ts:108
@Command({
name: 'import:workflow',
description: 'Import workflows',
examples: [
'--input=file.json',
'--separate --input=backups/latest/',
'--input=file.json --userId=1d64c3d2-85fe-4a83-a649-e446b07b3aae',
'--input=file.json --projectId=Ox8O54VQrmBrb4qL',
'--separate --input=backups/latest/ --userId=1d64c3d2-85fe-4a83-a649-e446b07b3aae',
'--input=file.json --activeState=fromJson',
],
flagsSchema,
})
export class ImportWorkflowsCommand extends BaseCommand<z.infer<typeof flagsSchema>> {
async run(): Promise<void> {
const { flags } = this;
if (flags.activeState === 'fromJson' && this.globalConfig.executions.mode !== 'queue') {
throw new UserError(
'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.',
);
}
if (!flags.input) {
this.logger.info('An input file or directory with --input must be provided');
return;
}
if (flags.separate) {
if (fs.existsSync(flags.input)) {
if (!fs.lstatSync(flags.input).isDirectory()) {
this.logger.info('The argument to --input must be a directory');
return;
}
}
}
View on GitHub (pinned to 5ac6606e81)
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.
Example fix
// before — regular mode n8n import:workflow --input=f.json --activeState=fromJson // after — either run in queue mode, or drop the flag N8N_EXECUTIONS_MODE=queue n8n start # then import // or n8n import:workflow --input=f.json # imports inactive
Defensive patterns
Strategy: validation
Validate before calling
function canUseFromJson(globalConfig: { executions: { mode: string } }): boolean {
return globalConfig.executions.mode === 'queue';
}
if (flags.activeState === 'fromJson' && !canUseFromJson(globalConfig)) {
throw new Error('--activeState=fromJson requires N8N_EXECUTIONS_MODE=queue');
} Try / catch
try {
await execN8n(['import:workflow', '--input', f, '--activeState=fromJson']);
} catch (e) {
if (e.message.includes('--activeState=fromJson')) {
// not in queue mode — fall back
await execN8n(['import:workflow', '--input', f]);
} else throw e;
} Prevention
- Only request --activeState=fromJson in queue-mode deployments.
- In regular mode, activate workflows post-import through the UI or API.
When it happens
Trigger: `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`.
Common situations: 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'.
Related errors
- File does not seem to contain valid workflows.
- You cannot use `--userId` and `--projectId` together. Use on
- The credential with ID "${workflow.id}" is already owned by
- Failed to find owner. ${UM_FIX_INSTRUCTION}
- No workflows found with specified filters
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/fa1dbf401a09c458.
Report an issue: GitHub.