n8n-io/n8n · warning · Error

Unexpected positional argument: ${arg}

Error message

Unexpected positional argument: ${arg}

What it means

Thrown by the CLI argument parser in export-latest-verifier-request.ts when a third positional argument is passed on the command line. The parser accepts at most two positional values: the first becomes the scenario name and the second the test-case path (resolved under evaluations/data/workflows/). Anything beyond that, or any token not starting with '--' after both slots are filled, is rejected. Named flags (--test-case-path, --scenario) are handled separately and do not count as positional.

Source

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

			case '--scenario': {
				scenarioName = argv[++i];
				if (!scenarioName) throw new Error('Missing value for --scenario');
				break;
			}
			default:
				if (arg.startsWith('--')) throw new Error(`Unknown flag: ${arg}`);
				if (!scenarioName) {
					scenarioName = arg;
				} else if (!testCasePath) {
					testCasePath = path.join(
						instanceAiRoot,
						'evaluations',
						'data',
						'workflows',
						`${arg}.json`,
					);
				} else {
					throw new Error(`Unexpected positional argument: ${arg}`);
				}
		}
	}

	return {
		testCasePath:
			testCasePath ??
			path.join(
				instanceAiRoot,
				'evaluations',
				'data',
				'workflows',
				'cross-team-linear-report.json',
			),
		scenarioName,
	};
}

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Pass at most two positional arguments: scenario name first, test case name (without .json) second.
  2. Prefer the named flags `--scenario <name>` and `--test-case-path <abs>` to avoid positional-order confusion.
  3. Quote shell arguments or disable globbing if a positional is expanding unexpectedly.

Example fix

// before
$ tsx export-latest-verifier-request.ts myScenario cross-team-linear-report extra-output
// after
$ tsx export-latest-verifier-request.ts myScenario cross-team-linear-report
Defensive patterns

Strategy: validation

Validate before calling

// Validate positional count before parsing, or restrict to named flags.
function assertPositionals(argv: string[]): void {
  const positionals = argv.filter((a) => !a.startsWith('--'));
  // exclude values consumed by named flags
  if (positionals.length > 2) {
    throw new Error(`Expected at most 2 positional args, got ${positionals.length}: ${positionals.join(', ')}`);
  }
}

Prevention

When it happens

Trigger: Running export-latest-verifier-request with three or more bare words, e.g. `tsx export-latest-verifier-request.ts scenarioA caseB extra`. Also triggers when a typo'd flag omits its leading '--' (so it is read as a positional) after both scenario and path slots are already filled.

Common situations: A copy-paste of an older command with a now-removed positional; passing a workflow id or output path as a bare word instead of a flag; a shell glob expanding to multiple positionals.

Related errors


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