{"record":{"id":"f3542332155378ce","repo":"n8n-io/n8n","slug":"delete-prebuilt-workflows-cannot-be-used-with","errorCode":null,"errorMessage":"--delete-prebuilt-workflows cannot be used with --keep-workflows","messagePattern":"--delete-prebuilt-workflows cannot be used with --keep-workflows","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/evaluations/cli/args.ts","lineNumber":209,"sourceCode":"\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, '');\n\t\tif (!raw.datasetProvided) {\n\t\t\tdataset = `instance-ai-langtracer-${suiteSlug}`;\n\t\t\tdatasetAutoForked = true;","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/evaluations/cli/args.ts#L191-L227","documentation":"Thrown by parseCliArgs() when both --delete-prebuilt-workflows and --keep-workflows are set. The two flags are logically contradictory: one deletes successfully-used workflows after evaluation, the other retains all built workflows. The parser refuses the combination so the run's intent is unambiguous.","triggerScenarios":"Invoking the eval CLI with both flags simultaneously: `... --keep-workflows --delete-prebuilt-workflows`. The check fires at args.ts:208.","commonSituations":"A developer merges two command templates (one for keeping, one for deleting) and forgets to reconcile them, or toggles flags while debugging and leaves both active.","solutions":["Remove --delete-prebuilt-workflows if you want to keep all workflows.","Remove --keep-workflows if you want pre-built workflows deleted after use."],"exampleFix":"// before\npnpm eval:instance-ai --prebuilt-workflows ./manifest.json --keep-workflows --delete-prebuilt-workflows\n// after (keep all)\npnpm eval:instance-ai --prebuilt-workflows ./manifest.json --keep-workflows\n// after (delete used prebuilt workflows)\npnpm eval:instance-ai --prebuilt-workflows ./manifest.json --delete-prebuilt-workflows","handlingStrategy":"validation","validationCode":"function validateNoKeepDeleteConflict(args: string[]): void {\n  if (args.includes('--keep-workflows') && args.includes('--delete-prebuilt-workflows')) {\n    throw new Error('--keep-workflows and --delete-prebuilt-workflows are mutually exclusive');\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Decide cleanup policy (keep vs delete) once per run and encode it in a single variable.","Avoid merging two command templates that each specify a different cleanup mode.","Use a wrapper that takes a single --cleanup={keep|delete} mode and expands to the right flag."],"tags":["cli","argument-validation","instance-ai","evaluations"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}