{"record":{"id":"7025ea9c81b63710","repo":"n8n-io/n8n","slug":"new-set-raw-buildonlyflags-join-onl","errorCode":null,"errorMessage":"${[...new Set(raw.buildOnlyFlags)].join(', ')} only take${raw.buildOnlyFlags.length === 1 ? 's' : ''} effect with --build-via-mcp — pass it, or drop the flag(s).","messagePattern":"(.+?) only take(.+?) effect with --build-via-mcp — pass it, or drop the flag\\(s\\)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/evaluations/cli/args.ts","lineNumber":201,"sourceCode":"\tif (validated.buildViaMcp && validated.deletePrebuiltWorkflows) {\n\t\tthrow new Error(\n\t\t\t'--delete-prebuilt-workflows applies to --prebuilt-workflows. --build-via-mcp already cleans up the workflows it builds unless --keep-workflows is set.',\n\t\t);\n\t}\n\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;","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/evaluations/cli/args.ts#L183-L219","documentation":"Thrown by parseCliArgs() when build-only flags (--mcp-server, --build-cwd, --build-max-attempts, --build-mcp-timeout-ms, --build-timeout-ms) are passed without --build-via-mcp. These flags are collected into raw.buildOnlyFlags during raw parsing; without --build-via-mcp they would parse and validate successfully but then be silently ignored, making the run look like it honored them. The parser fails loudly to prevent this silent misuse.","triggerScenarios":"Passing any of the build-knob flags (e.g. --build-max-attempts 5, --build-timeout-ms 600000) on the command line without also passing --build-via-mcp. The deduplicated set of offending flags is joined into the message; singular vs plural verb agreement is chosen by the count.","commonSituations":"A developer tunes build parameters for a regular (Instance AI orchestrator) run, not realizing those knobs only apply to MCP builds. Or a flag is left over after removing --build-via-mcp from a previously MCP-only command.","solutions":["Add --build-via-mcp to the command if you intend MCP builds.","Remove the offending build-only flag(s) listed in the error message if you do not want MCP builds.","Review the list of build-only flags in parseRawArgs() (args.ts cases for --mcp-server, --build-cwd, --build-max-attempts, --build-mcp-timeout-ms, --build-timeout-ms) to identify all of them."],"exampleFix":"// before\npnpm eval:instance-ai --build-max-attempts 5 --build-timeout-ms 600000 --base-url http://localhost:5678\n// after (MCP build intended)\npnpm eval:instance-ai --build-via-mcp --build-max-attempts 5 --build-timeout-ms 600000 --base-url http://localhost:5678\n// after (no MCP build — drop the knobs)\npnpm eval:instance-ai --base-url http://localhost:5678","handlingStrategy":"validation","validationCode":"const BUILD_ONLY_FLAGS = ['--mcp-server','--build-cwd','--build-max-attempts','--build-mcp-timeout-ms','--build-timeout-ms'];\nfunction validateBuildFlags(args: string[]): void {\n  const hasBuildViaMcp = args.includes('--build-via-mcp');\n  const offending = BUILD_ONLY_FLAGS.filter((f) => args.includes(f));\n  if (!hasBuildViaMcp && offending.length > 0) {\n    throw new Error(`${offending.join(', ')} require --build-via-mcp`);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Group build-only flags in command templates under a clearly labeled MCP section.","When removing --build-via-mcp from a command, also strip all build-only knobs.","Keep a reference list of which flags are build-only (the parseRawArgs cases that push to buildOnlyFlags)."],"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"}