{"record":{"id":"1681e5b0122d9c21","repo":"n8n-io/n8n","slug":"scenario-scenarioname-not-found-in-args-tes","errorCode":null,"errorMessage":"Scenario \"${scenarioName}\" not found in ${args.testCasePath}","messagePattern":"Scenario \"(.+?)\" not found in (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/evaluations/export-latest-verifier-request.ts","lineNumber":326,"sourceCode":"\treturn getTestCasePrompt(testCase)?.slice(0, 70);\n}\n\nfunction getWorkflowJson(workflowId: string): WorkflowJson {\n\tconst row = querySqlite(\n\t\t`select json_object('nodes', json(nodes), 'connections', json(connections)) from workflow_entity where id='${workflowId}';`,\n\t);\n\tif (!row) throw new Error(`Workflow ${workflowId} not found in sqlite db`);\n\treturn jsonParse<WorkflowJson>(row);\n}\n\nfunction main(): void {\n\tconst args = parseCliArgs(process.argv.slice(2));\n\tconst testCase = readJson<WorkflowTestCaseJson>(args.testCasePath);\n\tconst scenarios = getScenarios(testCase);\n\tconst scenarioName = args.scenarioName ?? scenarios[0]?.name;\n\tif (!scenarioName) throw new Error(`No scenarios found in ${args.testCasePath}`);\n\tconst scenario = scenarios.find((item) => item.name === scenarioName);\n\tif (!scenario) throw new Error(`Scenario \"${scenarioName}\" not found in ${args.testCasePath}`);\n\tconst evalResults = readJson<StoredEvalResults<EvalResult>>(evalResultsPath);\n\tconst storedTestCase = findStoredTestCaseResult(\n\t\tevalResults,\n\t\targs.testCasePath,\n\t\tgetSerializedTestCaseName(testCase),\n\t);\n\tconst storedRun = findStoredVerifierRun(storedTestCase, scenarioName);\n\tif (!storedRun) {\n\t\tthrow new Error(\n\t\t\t`eval-results.json does not include a workflowId and evalResult for scenario \"${scenarioName}\" in test case \"${getSerializedTestCaseName(testCase) ?? args.testCasePath}\". Re-run the workflow evals with this branch.`,\n\t\t);\n\t}\n\n\tconst workflowJson = getWorkflowJson(storedRun.workflowId);\n\tconst checklist = [\n\t\t{\n\t\t\tid: 1,\n\t\t\tdescription: scenario.successCriteria,","sourceCodeStart":308,"sourceCodeEnd":344,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/evaluations/export-latest-verifier-request.ts#L308-L344","documentation":"Thrown in main() when the resolved scenario name (from --scenario or defaulting to scenarios[0].name) does not match any entry in the test case's scenarios list. The lookup is an exact string equality on `item.name`. The error echoes the offending name and the file path so the author can see what was requested vs. what exists.","triggerScenarios":"Passing `--scenario Foo` when the fixture names its scenario `foo` (case mismatch) or `default`; renaming a scenario in the fixture without updating the CLI invocation or stored eval-results; a typo in the scenario name.","commonSituations":"Case-sensitivity mismatch; stale command in a script/shell history referencing a renamed scenario; copy-paste of a scenario name from docs that drifted from the fixture.","solutions":["List the scenario names in the fixture and pass the exact string to --scenario.","If you renamed the scenario in the fixture, update any scripts and re-run the eval so eval-results.json uses the new name.","Omit --scenario to use scenarios[0] as the default."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate the requested scenario against the fixture before lookup.\nconst validNames = new Set(scenarios.map((s) => s.name));\nif (scenarioName && !validNames.has(scenarioName)) {\n  throw new Error(`Unknown scenario \"${scenarioName}\" for ${args.testCasePath}. Valid: ${[...validNames].join(', ')}`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When renaming a scenario, update every script and stored eval-result together.","Print the available scenario names in the error (it already echoes the file path).","Default to scenarios[0] only when you are sure of stable fixture ordering."],"tags":["config","scenario","test-case","fixture"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}