n8n-io/n8n · error · Error
Workflow directory not found: ${workflowDir}
Error message
Workflow directory not found: ${workflowDir} What it means
The discoverSlugs function (line 405) lists all .json files in the workflow directory to build test cases when no explicit slugs are provided. If the directory does not exist, it throws rather than returning an empty list (which would silently produce 'No scenarios to build'). The directory defaults to packages/@n8n/instance-ai/evaluations/data/workflows/ under the repo root, or can be overridden with --workflow-dir.
Source
Thrown at packages/@n8n/instance-ai/evaluations/cli/build-mcp-manifest.ts:407
totalCostUSD: sum((r) => r.cost),
avgDurationMs: total > 0 ? sum((r) => r.durationMs) / total : 0,
},
builds: successful.map((r) => ({
slug: r.slug,
iteration: r.iteration,
workflowId: r.workflowId,
turns: r.turns,
costUSD: r.cost,
durationMs: r.durationMs,
})),
};
writeFileSync(args.statsPath, JSON.stringify(stats, null, 2));
}
function discoverSlugs(workflowDir: string): string[] {
if (!existsSync(workflowDir)) {
throw new Error(`Workflow directory not found: ${workflowDir}`);
}
return readdirSync(workflowDir)
.filter((f) => f.endsWith('.json'))
.map((f) => basename(f, '.json'))
.sort();
}
const tierDatasetsSchema = z.object({ datasets: z.array(z.string()).optional() }).passthrough();
/** A test case's `datasets`, defaulting to the shared eval default when absent — mirrors the loader schema. */
function readDatasets(workflowDir: string, slug: string): string[] {
const file = join(workflowDir, `${slug}.json`);
if (!existsSync(file)) return [];
try {
return (
tierDatasetsSchema.parse(readJson(file, `test case ${slug}`)).datasets ?? DEFAULT_DATASETS
);
} catch {View on GitHub (pinned to 5ac6606e81)
Solutions
- Pass --workflow-dir with the correct absolute path to your test-case JSON directory
- Run from inside the n8n repo so the default path resolves via git rev-parse
- Verify the directory exists: ls <path>
- Use --source langtracer to pull test cases from a remote suite instead of disk
Example fix
# before pnpm eval:build-mcp-manifest --workflow-dir /wrong/path # after pnpm eval:build-mcp-manifest --workflow-dir packages/@n8n/instance-ai/evaluations/data/workflows
Defensive patterns
Strategy: validation
Validate before calling
import { existsSync } from 'fs';
const workflowDir = args.workflowDir ?? defaultDir;
if (!existsSync(workflowDir)) {
throw new Error(`Workflow directory not found: ${workflowDir}`);
} Prevention
- Verify the workflow directory exists with ls before running
- When running outside the repo, always pass --workflow-dir explicitly
- Use absolute paths to avoid ambiguity
When it happens
Trigger: Running with --source disk (the default) when the default workflow directory does not exist (e.g. a shallow/partial checkout missing the data folder), or passing --workflow-dir <nonexistent-path>.
Common situations: Running from outside the n8n repo without --workflow-dir. A typo in the --workflow-dir path. The data/workflows directory has not been created yet or was cleaned by pnpm reset --full.
Related errors
- --build-cwd directory does not exist: ${args.buildCwd}
- Disk source needs the n8n repo (run from inside it) or --wor
- --max-attempts must be >= 1
- --source langtracer requires --suite <slug>
- Failed to parse ${label} at ${path}: ${msg}
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/880369489f27e824.
Report an issue: GitHub.