{"record":{"id":"2821e13653ad2e8d","repo":"n8n-io/n8n","slug":"found-multiple-eval-results-entries-for-test-case","errorCode":null,"errorMessage":"Found multiple eval-results entries for test case slug \"${slug}\"","messagePattern":"Found multiple eval-results entries for test case slug \"(.+?)\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/evaluations/eval-results-artifact.ts","lineNumber":44,"sourceCode":"\trunIndex: number;\n};\n\nexport function getTestCaseSlug(testCasePath: string): string {\n\treturn path.basename(testCasePath, path.extname(testCasePath));\n}\n\nexport function findStoredTestCaseResult<TEvalResult>(\n\tevalResults: StoredEvalResults<TEvalResult>,\n\ttestCasePath: string,\n\tserializedTestCaseName: string | undefined,\n): StoredTestCaseResult<TEvalResult> | undefined {\n\tconst slug = getTestCaseSlug(testCasePath);\n\tconst bySlug = evalResults.testCases.filter(\n\t\t(testCaseResult) => testCaseResult.testCaseFile === slug,\n\t);\n\tif (bySlug.length === 1) return bySlug[0];\n\tif (bySlug.length > 1) {\n\t\tthrow new Error(`Found multiple eval-results entries for test case slug \"${slug}\"`);\n\t}\n\n\tconst byName = serializedTestCaseName\n\t\t? evalResults.testCases.filter(\n\t\t\t\t(testCaseResult) => testCaseResult.name === serializedTestCaseName,\n\t\t\t)\n\t\t: [];\n\tif (byName.length === 1) return byName[0];\n\tif (byName.length > 1) {\n\t\tthrow new Error(\n\t\t\t`Found multiple eval-results entries for test case \"${serializedTestCaseName}\"`,\n\t\t);\n\t}\n\n\treturn evalResults.testCases.length === 1 ? evalResults.testCases[0] : undefined;\n}\n\nexport function findStoredVerifierRun<TEvalResult>(","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/evaluations/eval-results-artifact.ts#L26-L62","documentation":"Thrown by `findStoredTestCaseResult()` in eval-results-artifact.ts when matching stored eval-results entries by test-case slug (the filename without extension) yields more than one entry with the same `testCaseFile`. The function first tries slug-based matching, then falls back to name-based matching (error 435). Two entries with the same slug means the eval-results JSON has been duplicated or corrupted — usually a botched merge of two runs, or two different files that share a basename across different directories.","triggerScenarios":"Two test-case files in different subdirectories share the same basename (e.g. `workflows/foo.json` and `agents/foo.json`), and both wrote entries into `eval-results.json` keyed by slug `foo`. A manual edit/merge of `eval-results.json` duplicated a test-case block. An older run's results were concatenated onto a newer run's results without de-duplication.","commonSituations":"Merging eval-results artifacts across branches. Renaming a case file but leaving the old slug's results in the artifact. A bug in whatever writes `eval-results.json` that emits a second entry instead of updating the first.","solutions":["Open `eval-results.json` (path: `<instanceAiRoot>/eval-results.json`) and find the two `testCases` entries sharing the cited `testCaseFile` slug.","If one is stale (from a renamed/removed case), delete that entry.","If two genuinely different case files share a basename, rename one of the source files so slugs are unique, then regenerate the results.","Regenerate the artifact from a clean run rather than hand-merging."],"exampleFix":"// before (eval-results.json)\n{\n  \"testCases\": [\n    { \"testCaseFile\": \"slack-setup\", \"name\": \"old\", ... },\n    { \"testCaseFile\": \"slack-setup\", \"name\": \"new\", ... }\n  ]\n}\n// after (remove the stale entry)\n{\n  \"testCases\": [\n    { \"testCaseFile\": \"slack-setup\", \"name\": \"new\", ... }\n  ]\n}","handlingStrategy":"validation","validationCode":"function assertUniqueSlugs(results: StoredEvalResults<unknown>): void {\n  const seen = new Set<string>();\n  for (const t of results.testCases) {\n    if (t.testCaseFile && seen.has(t.testCaseFile)) {\n      throw new Error(`Duplicate slug: ${t.testCaseFile}`);\n    }\n    if (t.testCaseFile) seen.add(t.testCaseFile);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Give source case files unique basenames across all subdirs that feed the same artifact.","Regenerate `eval-results.json` from a single clean run rather than concatenating runs by hand.","In CI, assert slug uniqueness as a post-run check."],"tags":["eval-results","artifact","data-integrity","duplicate","configuration"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}