{"record":{"id":"b0d31b9b2c61719f","repo":"n8n-io/n8n","slug":"disk-source-needs-the-n8n-repo-run-from-inside-it","errorCode":null,"errorMessage":"Disk source needs the n8n repo (run from inside it) or --workflow-dir; or use --source langtracer.","messagePattern":"Disk source needs the n8n repo \\(run from inside it\\) or --workflow-dir; or use --source langtracer\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/evaluations/cli/build-mcp-manifest.ts","lineNumber":492,"sourceCode":"\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);\n\t\t\tfor (const slug of [...casesBySlug.keys()]) {\n\t\t\t\tif (!requested.has(slug)) casesBySlug.delete(slug);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tconst workflowDir =\n\t\t\targs.workflowDir ??\n\t\t\t(repoRoot\n\t\t\t\t? join(repoRoot, 'packages/@n8n/instance-ai/evaluations/data/workflows')\n\t\t\t\t: undefined);\n\t\tif (!workflowDir) {\n\t\t\tthrow new Error(\n\t\t\t\t'Disk source needs the n8n repo (run from inside it) or --workflow-dir; or use --source langtracer.',\n\t\t\t);\n\t\t}\n\t\tlet slugs = args.slugs.length > 0 ? args.slugs : discoverSlugs(workflowDir);\n\t\tif (args.tier) slugs = filterSlugsByTier(workflowDir, slugs, args.tier);\n\t\tfor (const slug of slugs) {\n\t\t\tconst file = join(workflowDir, `${slug}.json`);\n\t\t\tif (!existsSync(file)) {\n\t\t\t\tconsole.log(`  [${slug}] skip: scenario file missing`);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tcasesBySlug.set(slug, testCaseSchema.parse(readJson(file, `test case ${slug}`)).conversation);\n\t\t}\n\t}\n\t// Drop cases with no user turn to build from (e.g. `replay`-seeded only).\n\tfor (const [slug, conv] of [...casesBySlug]) {\n\t\tif (!conv.some((t) => t.role === 'user' && t.text.trim().length > 0)) {\n\t\t\tconsole.log(`  [${slug}] skip: no user turn to build from`);","sourceCodeStart":474,"sourceCodeEnd":510,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/evaluations/cli/build-mcp-manifest.ts#L474-L510","documentation":"When using the default disk source, the CLI resolves the test-case directory from the n8n repo root via `git rev-parse --show-toplevel`. If the script is not running inside a git repo (repoRoot is undefined) AND --workflow-dir is not provided, there is no way to locate test cases on disk. The error at line 492 suggests three concrete alternatives.","triggerScenarios":"Running the CLI from a directory that is not inside the n8n git repo, without --workflow-dir, and without --source langtracer. For example, running from /tmp or a non-repo directory.","commonSituations":"Running from /tmp or a scratch directory. The script was invoked outside the n8n checkout. A CI environment that does a shallow/partial clone without .git. Running from a worktree that lost its git context.","solutions":["Run from inside the n8n repo checkout (cd /path/to/n8n first)","Pass --workflow-dir with an explicit path to the test-case JSON directory","Use --source langtracer to pull test cases from a remote suite instead of disk"],"exampleFix":"# before (run from /tmp)\npnpm eval:build-mcp-manifest\n\n# after\ncd /path/to/n8n && pnpm eval:build-mcp-manifest","handlingStrategy":"validation","validationCode":"import { execSync } from 'child_process';\nimport { existsSync } from 'fs';\n\nlet repoRoot: string | undefined;\ntry {\n  repoRoot = execSync('git rev-parse --show-toplevel', { encoding: 'utf-8' }).trim();\n} catch { repoRoot = undefined; }\n\nconst workflowDir = args.workflowDir ?? (repoRoot ? join(repoRoot, '.../data/workflows') : undefined);\nif (!workflowDir) {\n  throw new Error('Disk source needs the n8n repo or --workflow-dir; or use --source langtracer.');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run from inside the n8n repo when using the disk source","Always pass --workflow-dir when running outside the repo","Use --source langtracer to avoid disk dependency entirely"],"tags":["cli","filesystem","path","build-mcp-manifest","prerequisites"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}