n8n-io/n8n · error · Error

Missing value for ${flag}

Error message

Missing value for ${flag}

What it means

The nextArg helper in langtracer-push (line 132) fetches the token following a flag in argv. It throws when the next token is undefined (flag is last argument) or starts with '--' (the next token looks like another flag). This prevents flags from being silently consumed as values, identical to the pattern in build-mcp-manifest.

Source

Thrown at packages/@n8n/instance-ai/evaluations/cli/langtracer-push.ts:134

		}
	}

	if (!result.suite) throw new Error('--suite <slug|id> is required');
	const hasSelector =
		result.slugs.length > 0 ||
		result.changed ||
		result.filter !== undefined ||
		result.tier !== undefined;
	if (!hasSelector) {
		throw new Error('select cases to push: pass <slugs...>, --changed, --filter, or --tier');
	}

	return { helpRequested: false, args: result };
}

function nextArg(argv: string[], i: number, flag: string): string {
	const value = argv[i + 1];
	if (value === undefined || value.startsWith('--')) throw new Error(`Missing value for ${flag}`);
	return value;
}

/** New/untracked + staged + modified `data/{workflows,agents}/*.json` slugs, from git. */
function gitChangedSlugs(): string[] {
	const out = execFileSync('git', ['status', '--porcelain', '--untracked-files=all'], {
		encoding: 'utf-8',
	});
	const slugs: string[] = [];
	for (const line of out.split('\n')) {
		if (!line.trim()) continue;
		const raw = line.slice(3).trim(); // strip the 2-char status + space
		const path = raw.includes(' -> ') ? raw.split(' -> ')[1] : raw; // rename → new path
		if (
			(path.includes('evaluations/data/workflows/') || path.includes('evaluations/data/agents/')) &&
			path.endsWith('.json')
		) {
			slugs.push(basename(path, '.json'));

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Provide the value immediately after the flag: --suite baseline
  2. Ensure the intended value does not start with '--'
  3. Recheck argument ordering for missing or misplaced tokens

Example fix

# before
pnpm eval:langtracer-push --suite --changed

# after
pnpm eval:langtracer-push --suite baseline --changed
Defensive patterns

Strategy: validation

Validate before calling

// Validate that every value-taking flag has a non-flag next token:
const VALUE_FLAGS = ['--suite', '--filter', '--exclude', '--tier', '--set-kind'];
for (let i = 0; i < argv.length; i++) {
  if (VALUE_FLAGS.includes(argv[i])) {
    const next = argv[i + 1];
    if (next === undefined || next.startsWith('--')) {
      throw new Error(`Missing value for ${argv[i]}`);
    }
  }
}

Prevention

When it happens

Trigger: Running `pnpm eval:langtracer-push --suite --changed` (value after --suite is --changed), or `--suite` as the last argument with nothing following.

Common situations: Missing value after a value-taking flag. Two flags accidentally adjacent. Shell quoting drops a value. Variable expansion produces an empty token.

Related errors


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