n8n-io/n8n · error · Error

Scenario "${scenarioName}" not found in ${args.testCasePath}

Error message

Scenario "${scenarioName}" not found in ${args.testCasePath}

What it means

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.

Source

Thrown at packages/@n8n/instance-ai/evaluations/export-latest-verifier-request.ts:326

	return getTestCasePrompt(testCase)?.slice(0, 70);
}

function getWorkflowJson(workflowId: string): WorkflowJson {
	const row = querySqlite(
		`select json_object('nodes', json(nodes), 'connections', json(connections)) from workflow_entity where id='${workflowId}';`,
	);
	if (!row) throw new Error(`Workflow ${workflowId} not found in sqlite db`);
	return jsonParse<WorkflowJson>(row);
}

function main(): void {
	const args = parseCliArgs(process.argv.slice(2));
	const testCase = readJson<WorkflowTestCaseJson>(args.testCasePath);
	const scenarios = getScenarios(testCase);
	const scenarioName = args.scenarioName ?? scenarios[0]?.name;
	if (!scenarioName) throw new Error(`No scenarios found in ${args.testCasePath}`);
	const scenario = scenarios.find((item) => item.name === scenarioName);
	if (!scenario) throw new Error(`Scenario "${scenarioName}" not found in ${args.testCasePath}`);
	const evalResults = readJson<StoredEvalResults<EvalResult>>(evalResultsPath);
	const storedTestCase = findStoredTestCaseResult(
		evalResults,
		args.testCasePath,
		getSerializedTestCaseName(testCase),
	);
	const storedRun = findStoredVerifierRun(storedTestCase, scenarioName);
	if (!storedRun) {
		throw new Error(
			`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.`,
		);
	}

	const workflowJson = getWorkflowJson(storedRun.workflowId);
	const checklist = [
		{
			id: 1,
			description: scenario.successCriteria,

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. List the scenario names in the fixture and pass the exact string to --scenario.
  2. If you renamed the scenario in the fixture, update any scripts and re-run the eval so eval-results.json uses the new name.
  3. Omit --scenario to use scenarios[0] as the default.
Defensive patterns

Strategy: validation

Validate before calling

// Validate the requested scenario against the fixture before lookup.
const validNames = new Set(scenarios.map((s) => s.name));
if (scenarioName && !validNames.has(scenarioName)) {
  throw new Error(`Unknown scenario "${scenarioName}" for ${args.testCasePath}. Valid: ${[...validNames].join(', ')}`);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/1681e5b0122d9c21. Report an issue: GitHub.