{"record":{"id":"1f005d2bba075eda","repo":"n8n-io/n8n","slug":"build-cwd-directory-does-not-exist-args-build","errorCode":null,"errorMessage":"--build-cwd directory does not exist: ${args.buildCwd}","messagePattern":"--build-cwd directory does not exist: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/evaluations/cli/build-mcp-manifest.ts","lineNumber":462,"sourceCode":"\t\texecSync('command -v claude', { stdio: 'ignore' });\n\t} catch {\n\t\tthrow new Error('claude not on PATH');\n\t}\n\n\t// Repo root scopes the staged MCP config (cwd fallback). Best-effort: the disk\n\t// source resolves/validates its own test-case dir below; langtracer pulls cases\n\t// over MCP, so it needs no repo at all and can run outside the n8n checkout.\n\tlet repoRoot: string | undefined;\n\ttry {\n\t\trepoRoot = execSync('git rev-parse --show-toplevel', { stdio: ['ignore', 'pipe', 'ignore'] })\n\t\t\t.toString()\n\t\t\t.trim();\n\t} catch {\n\t\trepoRoot = undefined;\n\t}\n\n\tif (args.buildCwd && !existsSync(args.buildCwd)) {\n\t\tthrow new Error(`--build-cwd directory does not exist: ${args.buildCwd}`);\n\t}\n\n\t// Resolve slug -> conversation from the chosen source. Disk reads --workflow-dir\n\t// (positional slugs or discovered), langtracer pulls a suite over MCP; both feed\n\t// the same buildOne prompt.\n\tconst casesBySlug = new Map<string, ConversationTurn[]>();\n\tif (args.source === 'langtracer') {\n\t\tconst suite = args.suite;\n\t\tif (!suite) throw new Error('--source langtracer requires --suite <slug>');\n\t\tconst cases = await loadTestCasesFromLangTracer({\n\t\t\tsuite,\n\t\t\ttier: args.tier,\n\t\t\tlogger: createLogger(false),\n\t\t});\n\t\tfor (const { fileSlug, testCase } of cases)\n\t\t\tcasesBySlug.set(fileSlug, testCase.conversation ?? []);\n\t\tif (args.slugs.length > 0) {\n\t\t\tconst requested = new Set(args.slugs);","sourceCodeStart":444,"sourceCodeEnd":480,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/evaluations/cli/build-mcp-manifest.ts#L444-L480","documentation":"The --build-cwd flag sets the working directory for the build subprocess (where claude -p runs), letting the user spawn the builder from a project where they have Claude skills/settings configured. main() (line 461) checks existsSync(args.buildCwd) and throws if the directory does not exist, preventing the subprocess from failing later with a less informative error.","triggerScenarios":"Running `pnpm eval:build-mcp-manifest --build-cwd /nonexistent/path`. The check fires after git repo-root resolution but before any build work begins.","commonSituations":"Typo in the path. The directory was deleted or not yet created. A relative path resolved against an unexpected working directory.","solutions":["Verify the directory exists: ls <path>","Use an absolute path to avoid ambiguity with the current working directory","Create the directory if needed: mkdir -p <path>","Omit --build-cwd to use the default (repo root when inside the repo, otherwise process.cwd())"],"exampleFix":"# before\npnpm eval:build-mcp-manifest --build-cwd ~/projects/wrong\n\n# after\npnpm eval:build-mcp-manifest --build-cwd ~/projects/correct","handlingStrategy":"validation","validationCode":"import { existsSync } from 'fs';\nif (args.buildCwd && !existsSync(args.buildCwd)) {\n  throw new Error(`--build-cwd directory does not exist: ${args.buildCwd}`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use absolute paths for --build-cwd","Verify the directory exists with ls before running","Omit --build-cwd if you do not need a custom build working directory"],"tags":["cli","filesystem","path","validation","build-mcp-manifest"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}