n8n-io/n8n · error · UserError
No workflows with published versions found.
Error message
No workflows with published versions found.
What it means
Thrown by `export:workflow` when `--published` is set without `--id` (i.e. with `--all` or `--projectId`), workflows were found, but none of them have a published version resolvable through WorkflowHistoryRepository. The aggregate counterpart of error 1301.
Source
Thrown at packages/cli/src/commands/export/workflow.ts:138
}
const workflows = await Container.get(WorkflowRepository).find({
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].idView on GitHub (pinned to 5ac6606e81)
Solutions
- Drop `--published` to export current draft versions of all workflows.
- Activate workflows in the UI before exporting their published versions.
- Audit: `SELECT count(*) FILTER (WHERE active_version_id IS NULL) FROM workflow_entity;` to see how many lack published versions.
Example fix
// before n8n export:workflow --all --published --output=backups/ // after n8n export:workflow --all --output=backups/
Defensive patterns
Strategy: validation
Validate before calling
// Count workflows with a non-null activeVersionId before bulk --published export
async function publishedCount(ds: DataSource): Promise<number> {
const { count } = await ds.getRepository('workflow_entity')
.createQueryBuilder('w').where('w.activeVersionId IS NOT NULL').getCount();
return count;
}
if (await publishedCount(ds) === 0) {
console.error('No published workflows — dropping --published flag');
flags.published = false;
} Try / catch
try {
await execN8n(['export:workflow', '--all', '--published', '--output', dir]);
} catch (e) {
if (e.message.includes('No workflows with published versions')) {
await execN8n(['export:workflow', '--all', '--output', dir]);
} else throw e;
} Prevention
- Before bulk --published export, count workflows with non-null activeVersionId.
- Don't rely on --published for dev instances where workflows are rarely activated.
When it happens
Trigger: `n8n export:workflow --all --published` or `--projectId=X --published` where every matched workflow has a null activeVersionId, has never been activated, or whose history rows are absent.
Common situations: Bulk export on a dev instance where workflows were created via CLI/import but never activated through the UI; history pruning removed all version rows; environments where workflow activation is disabled.
Related errors
- No published version found for workflow "${workflows[0].name
- No workflows found with specified filters
- Version "${flags.version}" not found for workflow "${workflo
- No credentials found with specified filters
- Filesystem error while creating the output directory: ${e in
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/263de5029e9cf33f.
Report an issue: GitHub.