n8n-io/n8n · error · Error

Missing value for ${flag}

Error message

Missing value for ${flag}

What it means

Thrown by the `next()` helper in computer-use/cli.ts when a value-bearing flag is followed by either end-of-argv or another `--` token. The helper deliberately treats a following `--flag` as 'you forgot the value' rather than consuming it as a value, so `--base-url --filter slack` is read as a missing value for `--base-url`, not `--base-url=--filter`. Protects against silently setting a flag's value to the name of another flag.

Source

Thrown at packages/@n8n/instance-ai/evaluations/computer-use/cli.ts:122

				break;
			case '--keep-data':
				raw.keepData = true;
				break;
			default:
				if (arg.startsWith('--')) {
					throw new Error(`Unknown flag: ${arg.split('=', 1)[0]}`);
				}
				throw new Error('Unexpected positional argument');
		}
	}

	return argsSchema.parse(raw);
}

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

// ---------------------------------------------------------------------------
// Scenario discovery
// ---------------------------------------------------------------------------

async function discoverScenarios(dataDir: string, filter?: string): Promise<Scenario[]> {
	const entries = await readdir(dataDir);
	const files = entries.filter((f) => f.endsWith('.json'));
	const scenarios: Scenario[] = [];

	for (const file of files) {
		const raw = await readFile(join(dataDir, file), 'utf-8');
		const parsed = jsonParse<Scenario>(raw, { errorMessage: `Invalid scenario JSON in ${file}` });
		if (filter && !parsed.id.includes(filter) && !file.includes(filter)) continue;
		scenarios.push(withDefaultGraders(parsed));

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Supply the missing value immediately after the flag: `--base-url http://localhost:5678`.
  2. If a value legitimately starts with `--` (e.g. a token), this parser cannot express it inline — pass it via the corresponding environment variable or a config file instead, or pre-process argv to use a `=` form the parser does not currently support (requires a code change).
  3. Audit CI scripts for `${VAR}` interpolations that may resolve to empty and leave a flag dangling.

Example fix

// before
$ node cli.ts --base-url --filter slack
// after
$ node cli.ts --base-url http://localhost:5678 --filter slack
Defensive patterns

Strategy: validation

Validate before calling

// Pair each value-bearing flag with its value before invoking.
const VALUE_FLAGS = new Set(['--base-url','--email','--password','--filter','--timeout-ms','--output-dir','--daemon-sandbox-dir']);
function checkValues(argv: string[]): string[] {
  const problems: string[] = [];
  for (let i = 0; i < argv.length; i++) {
    if (VALUE_FLAGS.has(argv[i])) {
      const next = argv[i + 1];
      if (next === undefined || next.startsWith('--')) problems.push(argv[i]);
    }
  }
  return problems;
}
const missing = checkValues(process.argv.slice(2));
if (missing.length) throw new Error(`Missing values for: ${missing.join(', ')}`);

Prevention

When it happens

Trigger: `--base-url` as the last token on the command line. `--filter --verbose` (intended `--filter foo --verbose`). `--email --password secret` (forgot the email value). Any value-bearing flag whose value legitimately starts with `--` (rare but possible — e.g. a password that starts with dashes) cannot be expressed positionally and must be supplied another way.

Common situations: Developers reorder flags and forget the value. CI YAML strips an empty environment variable that was meant to be interpolated as the value, leaving the flag dangling. A password or token starting with `--` cannot be passed positionally at all here.

Related errors


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