nexu-io/open-design · error · Error
flag --${key} requires a value
Error message
flag --${key} requires a value What it means
Thrown by parseFlags when a declared string flag is the last argv token, so it has no following token to consume as its value. Boolean flags do not need a value; this fires only for flags in the string set.
Source
Thrown at apps/daemon/src/cli.ts:1760
const eq = a.indexOf('=');
const key = eq >= 0 ? a.slice(2, eq) : a.slice(2);
if (knownFlags.size > 0 && !knownFlags.has(key)) {
throw new Error(
`unknown flag: --${key}. Run with --help for the list of accepted flags.`,
);
}
if (eq >= 0) {
out[key] = a.slice(eq + 1);
continue;
}
if (booleanFlags.has(key)) {
out[key] = true;
continue;
}
if (stringFlags.has(key)) {
const next = argv[i + 1];
if (next == null) {
throw new Error(`flag --${key} requires a value`);
}
out[key] = next;
i++;
continue;
}
const next = argv[i + 1];
if (next != null && !next.startsWith('--')) {
out[key] = next;
i++;
} else {
out[key] = true;
}
}
return out;
}
function positionalArgs(argv, stringFlags = new Set()) {
const out = [];View on GitHub (pinned to 5be4028344)
Solutions
- Provide a value as the next token: `--name <value>`.
- Use the `--key=value` form which keeps flag and value in one token.
- If the value comes from an env var, default it inside the shell so it is never empty.
- Re-run with --help to confirm which flags are string flags requiring a value.
Example fix
# before od automation create --name # after od automation create --name daily-brand-report # or od automation create --name=daily-brand-report
Defensive patterns
Strategy: validation
Validate before calling
// in wrapper scripts, ensure every string flag has a value
for (let i = 0; i < argv.length; i++) {
if (argv[i].startsWith('--') && !argv[i].includes('=')) {
const key = argv[i].slice(2);
if (STRING_FLAGS.has(key) && !argv[i + 1]) {
throw new Error(`flag --${key} requires a value`);
}
}
} Prevention
- Prefer the `--key=value` form so flag and value stay in one token.
- Default env-var-derived values in the shell so they are never empty.
- Re-run with --help to confirm which flags are string flags.
When it happens
Trigger: Invoking an `od` subcommand with a string flag at the end of the args without a value, e.g. `od automation create --name` (no following value) or `od brand rebuild --id`.
Common situations: Truncated copy-paste of a command; a shell that swallowed the value via unquoted whitespace; an env-var substitution that expanded to empty and was then dropped; forgetting the value entirely.
Related errors
- unknown flag: --${key}. Run with --help for the list of acce
- --schedule is required. Forms: hourly:<minute> | daily:HH:MM
- --schedule hourly requires :<minute>, 0-59
- --schedule ${kind} requires :HH:MM[:TZ]
- invalid JSON in ${filePath}: ${message}
AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12).
Data as JSON: /api/errors/db03caacacca1130.
Report an issue: GitHub.