{"record":{"id":"d00b37b90ffb8db0","repo":"n8n-io/n8n","slug":"delete-prebuilt-workflows-requires-prebuilt-wo","errorCode":null,"errorMessage":"--delete-prebuilt-workflows requires --prebuilt-workflows","messagePattern":"--delete-prebuilt-workflows requires --prebuilt-workflows","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/evaluations/cli/args.ts","lineNumber":206,"sourceCode":"\t// MCP builds are LangSmith-only: the keyless direct loop parallelizes\n\t// iterations without the lane allocator, so its 4-per-lane build cap applies\n\t// PER ITERATION — concurrent `claude` sessions would scale with\n\t// lanes × iterations × 4 and flood the shared Anthropic budget. Fail fast\n\t// instead of teaching the direct loop (tech debt slated for removal) MCP builds.\n\tif (validated.buildViaMcp && !process.env.LANGSMITH_API_KEY) {\n\t\tthrow new Error(\n\t\t\t'--build-via-mcp requires LangSmith experiment tracking — set LANGSMITH_API_KEY. The no-LangSmith direct loop does not support MCP builds.',\n\t\t);\n\t}\n\t// Build knobs without --build-via-mcp would parse fine and then be silently\n\t// ignored — the run would look like it honored them. Fail loudly instead.\n\tif (!validated.buildViaMcp && raw.buildOnlyFlags.length > 0) {\n\t\tthrow new Error(\n\t\t\t`${[...new Set(raw.buildOnlyFlags)].join(', ')} only take${raw.buildOnlyFlags.length === 1 ? 's' : ''} effect with --build-via-mcp — pass it, or drop the flag(s).`,\n\t\t);\n\t}\n\tif (validated.deletePrebuiltWorkflows && !validated.prebuiltWorkflows) {\n\t\tthrow new Error('--delete-prebuilt-workflows requires --prebuilt-workflows');\n\t}\n\tif (validated.deletePrebuiltWorkflows && validated.keepWorkflows) {\n\t\tthrow new Error('--delete-prebuilt-workflows cannot be used with --keep-workflows');\n\t}\n\tif (validated.source === 'langtracer' && !validated.suite) {\n\t\tthrow new Error('--source langtracer requires --suite <slug>');\n\t}\n\n\t// In langtracer mode, default the dataset + baseline to a suite-scoped, eval-tagged\n\t// name so runs don't pollute the shared cohort and re-runs upsert one stable dataset.\n\tlet dataset = validated.dataset;\n\tlet datasetAutoForked = false;\n\tlet baselinePrefix = validated.baselinePrefix;\n\tif (validated.source === 'langtracer' && validated.suite) {\n\t\tconst suiteSlug = validated.suite\n\t\t\t.toLowerCase()\n\t\t\t.replace(/[^a-z0-9]+/g, '-')\n\t\t\t.replace(/^-+|-+$/g, '');","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/evaluations/cli/args.ts#L188-L224","documentation":"Thrown by parseCliArgs() when --delete-prebuilt-workflows is set but --prebuilt-workflows is not. The delete flag's sole purpose is to clean up workflows that were consumed from a pre-built manifest after evaluation; without a manifest path there is nothing to delete. The parser rejects the orphan flag rather than silently no-op'ing.","triggerScenarios":"Invoking the eval CLI with `--delete-prebuilt-workflows` but no `--prebuilt-workflows <path>` argument. The check fires at args.ts:205 after the build-via-mcp checks.","commonSituations":"A developer removes or comments out the --prebuilt-workflows line in a script but leaves --delete-prebuilt-workflows. Or the flag is copy-pasted from a different run configuration that did include a manifest.","solutions":["Add --prebuilt-workflows <path-to-manifest.json> to the command.","Remove --delete-prebuilt-workflows if you are not working with pre-built workflows."],"exampleFix":"// before\npnpm eval:instance-ai --delete-prebuilt-workflows --base-url http://localhost:5678\n// after\npnpm eval:instance-ai --prebuilt-workflows ./manifest.json --delete-prebuilt-workflows --base-url http://localhost:5678","handlingStrategy":"validation","validationCode":"function validateDeleteRequiresPrebuilt(args: string[]): void {\n  if (args.includes('--delete-prebuilt-workflows') && !args.includes('--prebuilt-workflows')) {\n    throw new Error('--delete-prebuilt-workflows requires --prebuilt-workflows');\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat --delete-prebuilt-workflows as a modifier that only makes sense alongside --prebuilt-workflows.","When editing command templates, remove dependent flags when their primary is removed.","Add a lint check in run scripts that scans for orphaned modifier flags."],"tags":["cli","argument-validation","instance-ai","evaluations"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}