n8n-io/n8n · error · Error

Missing value for ${flagName}

Error message

Missing value for ${flagName}

What it means

Thrown by the nextArg() helper (args.ts:526) when a flag that expects a value is either the last token in argv or is immediately followed by another --flag. The helper refuses to consume a following --token as a value because that would silently swallow the next flag's name. This protects against malformed commands where a value was forgotten.

Source

Thrown at packages/@n8n/instance-ai/evaluations/cli/args.ts:526

				if (arg.startsWith('--')) {
					const flagName = arg.split('=', 1)[0];
					throw new Error(`Unknown flag: ${flagName}`);
				}
				throw new Error('Unexpected positional argument');
		}
	}

	return result;
}

// ---------------------------------------------------------------------------
// Helpers
// ---------------------------------------------------------------------------

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

function parseIntArg(argv: string[], currentIndex: number, flagName: string): number {
	const raw = nextArg(argv, currentIndex, flagName);
	const parsed = parseInt(raw, 10);
	if (Number.isNaN(parsed)) {
		// Don't echo raw — a bad shell expansion could leak a secret here.
		throw new Error(`Invalid integer for ${flagName}`);
	}
	return parsed;
}

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Provide a value immediately after the flag: `--flag value`.
  2. If the intended value genuinely starts with --, pass it in =form if supported, or quote/restructure the command so it is not ambiguous.
  3. Re-check the command for a missing value due to editing or copy-paste.

Example fix

// before
pnpm eval:instance-ai --base-url --filter contact-form
// after
pnpm eval:instance-ai --base-url http://localhost:5678 --filter contact-form
Defensive patterns

Strategy: validation

Validate before calling

const VALUE_FLAGS = new Set(['--timeout-ms','--base-url','--email','--password','--filter','--exclude','--prebuilt-workflows','--output-dir','--iterations','--dataset','--concurrency','--experiment-name','--pin-ai-roots','--tier','--baseline-prefix','--source','--suite','--mcp-server','--build-cwd','--build-max-attempts','--build-mcp-timeout-ms','--build-timeout-ms']);
function validateFlagValues(args: string[]): void {
  for (let i = 0; i < args.length; i++) {
    if (VALUE_FLAGS.has(args[i].split('=',1)[0])) {
      const v = args[i + 1];
      if (v === undefined || v.startsWith('--')) {
        throw new Error(`Missing value for ${args[i]}`);
      }
    }
  }
}

Prevention

When it happens

Trigger: Any value-taking flag (--timeout-ms, --base-url, --email, --password, --filter, --exclude, --prebuilt-workflows, --output-dir, --iterations, --dataset, --concurrency, --experiment-name, --pin-ai-roots, --tier, --baseline-prefix, --source, --suite, --mcp-server, --build-cwd, --build-max-attempts, --build-mcp-timeout-ms, --build-timeout-ms) placed at the end of the command, or immediately before another --flag.

Common situations: A value is accidentally deleted during command editing, a shell variable expansion produced an empty/missing value, or flags were reordered so a value landed elsewhere. Also common when a value starts with -- (e.g. a negative number is fine, but a string value beginning with -- is rejected).

Related errors


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