n8n-io/n8n · error · UserError

No workflows found with specified filters

Error message

No workflows found with specified filters

What it means

Thrown by the `export:workflow` CLI command when the WorkflowRepository lookup with the supplied filters returns zero rows. The filters come from `--id`, `--projectId`, or `--all` (the selector logic in getWhereFilter). It is a UserError, meaning the user-supplied input — not the system — is at fault.

Source

Thrown at packages/cli/src/commands/export/workflow.ts:128

					`Filesystem error while creating the output directory: ${e instanceof Error ? e.message : String(e)}`,
				);
			}
		} else if (flags.output) {
			if (fs.existsSync(flags.output)) {
				if (fs.lstatSync(flags.output).isDirectory()) {
					this.logger.info('The parameter --output must be a writeable file');
					return;
				}
			}
		}

		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');

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. List workflows first with `n8n list:workflow` (or query the DB) to confirm the ID/projectId exists in this environment.
  2. Drop the `--id`/`--projectId` filter and use `--all` to confirm the DB has any workflows at all.
  3. Verify you are pointed at the correct n8n database (check N8N_DEFAULT_BINARY_DATA_MODE / DB env vars).

Example fix

// before
n8n export:workflow --id=abc123 --output=out.json
// after — verify the ID exists first
n8n list:workflow
n8n export:workflow --id=<id-from-list> --output=out.json
Defensive patterns

Strategy: validation

Validate before calling

import { DataSource } from '@n8n/db';
// Before export, confirm the workflow exists
async function workflowExists(ds: DataSource, id: string): Promise<boolean> {
  return await ds.getRepository('workflow_entity').exist({ where: { id } });
}
if (!(await workflowExists(ds, flags.id))) {
  console.error('Workflow not found — skipping export');
  process.exit(0);
}

Try / catch

try {
  await execN8n(['export:workflow', '--id', id, '--output', out]);
} catch (e) {
  if (e.message.includes('No workflows found')) {
    // expected when source env is empty — skip gracefully
  } else throw e;
}

Prevention

When it happens

Trigger: Running `n8n export:workflow --id=<non-existent-id>`, `--projectId=<project-with-no-workflows>`, or `--all` against a fresh/empty n8n database. The check at workflow.ts:127 fires before any version resolution, so even workflows missing history still count as found at this stage.

Common situations: Wrong workflow ID copied from a different environment; targeting a projectId whose workflows were deleted; running export against a newly initialised SQLite DB before any workflows exist; mistyping the ID.

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/d8c83d5a892006ef. Report an issue: GitHub.