n8n-io/n8n · error · UserError
Version " " not found for workflow " " ( )
Error message
Version "${flags.version}" not found for workflow "${workflows[0].name}" (${workflows[0].id}) What it means
Thrown by `export:workflow` when `--version` and `--id` are set, the workflow exists, but the specified version ID is not present in WorkflowHistoryRepository for that workflow. getWorkflowsToExport filters out the workflow because history lookup yields nothing.
Solutions
- List the workflow's versions from the history table to find a valid versionId.
- Drop `--version` to export the current version.
- Confirm the version belongs to this workflow: `SELECT * FROM workflow_history WHERE workflow_id=X`.
Example fix
// before n8n export:workflow --id=X --version=abc-def // after — find valid versions first // SELECT version_id, saved_at FROM workflow_history WHERE workflow_id='X' ORDER BY saved_at DESC LIMIT 5; n8n export:workflow --id=X --version=<valid-version-id>
Defensive patterns
Strategy: validation
Validate before calling
// Verify the version exists in history before exporting
async function versionExists(ds: DataSource, workflowId: string, versionId: string): Promise<boolean> {
return await ds.getRepository('workflow_history').exist({ where: { workflowId, versionId } });
}
if (!(await versionExists(ds, workflowId, versionId))) {
throw new Error(`Version ${versionId} not in history for workflow ${workflowId}`);
} Try / catch
try {
await execN8n(['export:workflow', '--id', id, '--version', vid]);
} catch (e) {
if (e.message.startsWith('Version "')) {
// list available versions and pick one
} else throw e;
} Prevention
- Always look up versionId from workflow_history, never copy from another environment.
- Confirm versionId belongs to the workflow: WHERE workflow_id = X AND version_id = Y.
When it happens
Trigger: `n8n export:workflow --id=X --version=nonexistent-uuid`. The version ID does not match any `workflowId/versionId` pair in the history table.
Common situations: Typing or copying the version ID incorrectly; version belonged to a different workflow; history retention policy deleted old versions; cross-environment export where version IDs differ.
Related errors
- No published version found for workflow
- No workflows found with specified filters
- No workflows with published versions found.
- Failed to find owner.
- File does not seem to contain valid workflows.
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/96462d00e105eafb.
Report an issue: GitHub.
Appendix: source
Thrown at packages/cli/src/commands/export/workflow.ts:141
where: this.getWhereFilter(flags),
relations: ['tags', 'shared', 'shared.project'],
});
if (workflows.length === 0) {
throw new UserError('No workflows found with specified filters');
}
const workflowsToExport = await getWorkflowsToExport(workflows, flags);
if (flags.published && workflowsToExport.length === 0) {
if (flags.id)
throw new UserError(
`No published version found for workflow "${workflows[0].name}" (${workflows[0].id})`,
);
else throw new UserError('No workflows with published versions found.');
}
if (flags.version && flags.id && workflowsToExport.length === 0) {
throw new UserError(
`Version "${flags.version}" not found for workflow "${workflows[0].name}" (${workflows[0].id})`,
);
}
if (workflowsToExport.length === 0) {
throw new UserError('No workflows found with specified filters');
}
if (flags.separate) {
let fileContents: string;
let i: number;
for (i = 0; i < workflowsToExport.length; i++) {
fileContents = JSON.stringify(workflowsToExport[i], null, flags.pretty ? 2 : undefined);
const filename = `${
(flags.output!.endsWith(path.sep) ? flags.output : flags.output + path.sep) +
workflowsToExport[i].id
}.json`;
fs.writeFileSync(filename, fileContents);
}View on GitHub (pinned to 5ac6606e81)