n8n-io/n8n · error · Error
--delete-prebuilt-workflows applies to --prebuilt-workflows.
Error message
--delete-prebuilt-workflows applies to --prebuilt-workflows. --build-via-mcp already cleans up the workflows it builds unless --keep-workflows is set.
What it means
This error is thrown by parseCliArgs() in the instance-ai workflow evaluator CLI when both --build-via-mcp and --delete-prebuilt-workflows are passed together. --delete-prebuilt-workflows only applies to workflows loaded via --prebuilt-workflows, whereas --build-via-mcp builds fresh workflows via the MCP server on each lane and has its own lifecycle (it cleans up after itself unless --keep-workflows is set). Combining the two is a no-op at best and a confusing contradiction at worst, so the parser rejects it eagerly.
Source
Thrown at packages/@n8n/instance-ai/evaluations/cli/args.ts:184
buildTimeoutMs: z.number().int().nonnegative().default(DEFAULT_MCP_BUILD_TIMEOUT_MS),
});
// ---------------------------------------------------------------------------
// Public API
// ---------------------------------------------------------------------------
export function parseCliArgs(argv: string[]): CliArgs {
const raw = parseRawArgs(argv);
const validated = cliArgsSchema.parse(raw);
// --build-via-mcp checks first: they give clearer guidance than the generic
// --delete-prebuilt-workflows check below when both are combined.
if (validated.buildViaMcp && validated.prebuiltWorkflows) {
throw new Error(
'--build-via-mcp is incompatible with --prebuilt-workflows. --build-via-mcp builds fresh workflows via the MCP server on each lane; --prebuilt-workflows verifies existing ones.',
);
}
if (validated.buildViaMcp && validated.deletePrebuiltWorkflows) {
throw new Error(
'--delete-prebuilt-workflows applies to --prebuilt-workflows. --build-via-mcp already cleans up the workflows it builds unless --keep-workflows is set.',
);
}
// MCP builds are LangSmith-only: the keyless direct loop parallelizes
// iterations without the lane allocator, so its 4-per-lane build cap applies
// PER ITERATION — concurrent `claude` sessions would scale with
// lanes × iterations × 4 and flood the shared Anthropic budget. Fail fast
// instead of teaching the direct loop (tech debt slated for removal) MCP builds.
if (validated.buildViaMcp && !process.env.LANGSMITH_API_KEY) {
throw new Error(
'--build-via-mcp requires LangSmith experiment tracking — set LANGSMITH_API_KEY. The no-LangSmith direct loop does not support MCP builds.',
);
}
// Build knobs without --build-via-mcp would parse fine and then be silently
// ignored — the run would look like it honored them. Fail loudly instead.
if (!validated.buildViaMcp && raw.buildOnlyFlags.length > 0) {
throw new Error(
`${[...new Set(raw.buildOnlyFlags)].join(', ')} only take${raw.buildOnlyFlags.length === 1 ? 's' : ''} effect with --build-via-mcp — pass it, or drop the flag(s).`,View on GitHub (pinned to 5ac6606e81)
Solutions
- Remove --delete-prebuilt-workflows from the command: MCP builds auto-clean unless --keep-workflows is set, so the flag is redundant.
- If you want MCP builds retained, drop --delete-prebuilt-workflows and add --keep-workflows instead.
- If you actually want to delete pre-built workflows, drop --build-via-mcp and use --prebuilt-workflows <path> --delete-prebuilt-workflows.
Example fix
// before pnpm eval:instance-ai --build-via-mcp --delete-prebuilt-workflows --base-url http://localhost:5678 // after pnpm eval:instance-ai --build-via-mcp --base-url http://localhost:5678
Defensive patterns
Strategy: validation
Validate before calling
// Before invoking parseCliArgs, or in a wrapper script:
function assertNoBuildViaMcpWithDelete(args: string[]): void {
if (args.includes('--build-via-mcp') && args.includes('--delete-prebuilt-workflows')) {
throw new Error('Cannot combine --build-via-mcp with --delete-prebuilt-workflows (MCP auto-cleans).');
}
} Prevention
- Keep MCP-mode and prebuilt-mode flag templates in separate scripts to avoid cross-contamination.
- Audit command templates after switching build modes: grep for --delete-prebuilt-workflows whenever --build-via-mcp is present.
- Document the two exclusive run modes in your eval runbook.
When it happens
Trigger: Invoking the eval CLI with both flags: `... --build-via-mcp --delete-prebuilt-workflows`. The check fires after Zod validation succeeds but before any run logic, at args.ts:183. It is checked before the LANGSMITH_API_KEY check so the user gets the clearest guidance first.
Common situations: A developer copy-pastes a long flag list from a previous --prebuilt-workflows run and appends --build-via-mcp without removing --delete-prebuilt-workflows, or vice versa. Also occurs when refactoring a run script from one mode to the other and forgetting to strip the now-irrelevant flag.
Related errors
- ${[...new Set(raw.buildOnlyFlags)].join(', ')} only take${ra
- --delete-prebuilt-workflows requires --prebuilt-workflows
- --delete-prebuilt-workflows cannot be used with --keep-workf
- --source langtracer requires --suite <slug>
- Unknown flag: ${flagName}
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/4ff0c9c497e4dc1c.
Report an issue: GitHub.