Yeachan-Heo/oh-my-codex · error · AutoresearchGoalError
Missing value for ${flag}.
Error message
Missing value for ${flag}. What it means
readValue() in the autoresearch-goal CLI throws when a flag is present but its following argument is missing or looks like another flag (starts with '--'). Flags support both `--flag value` and `--flag=value` forms.
Source
Thrown at src/cli/autoresearch-goal.ts:52
Goal-mode boundary:
This command does not revive deprecated omx autoresearch and does not mutate hidden Codex /goal state.
It writes durable OMX artifacts and prints a model-facing handoff for get_goal/create_goal/update_goal.
Completion is blocked until professor-critic validation records verdict=pass.
`;
function hasFlag(args: readonly string[], flag: string): boolean {
return args.includes(flag);
}
function readValue(args: readonly string[], flag: string): string | undefined {
const prefix = `${flag}=`;
const inline = args.find((arg) => arg.startsWith(prefix));
if (inline !== undefined) return inline.slice(prefix.length);
const index = args.indexOf(flag);
if (index < 0) return undefined;
const value = args[index + 1];
if (!value || value.startsWith('--')) throw new AutoresearchGoalError(`Missing value for ${flag}.`);
return value;
}
async function readMaybeFile(value: string | undefined): Promise<string | undefined> {
if (!value) return undefined;
if (value.startsWith('@')) return readFile(value.slice(1), 'utf-8');
return value;
}
function positionalText(args: readonly string[]): string {
const valueTaking = new Set(['--topic', '--rubric', '--critic-command', '--slug', '--verdict', '--evidence', '--summary', '--artifact', '--codex-goal-json']);
const words: string[] = [];
for (let i = 0; i < args.length; i++) {
const arg = args[i];
if (valueTaking.has(arg)) { i += 1; continue; }
if (arg.startsWith('--')) continue;
words.push(arg);
}View on GitHub (pinned to 3ad79a8a6f)
Solutions
- Use the inline form `--flag=value` which cannot be confused with following flags
- Ensure every flag is followed by a concrete value, or omit the flag entirely if it is optional
- Check the error message — it names exactly which flag lacked a value
Example fix
// before omx autoresearch-goal verdict --slug --verdict pass // after omx autoresearch-goal verdict --slug=my-goal --verdict pass
Defensive patterns
Strategy: validation
Validate before calling
function readValueSafe(args: string[], flag: string): string | undefined {
const i = args.indexOf(flag);
if (i < 0) return undefined;
const v = args[i+1];
if (!v || v.startsWith('--')) throw new UsageError(`Missing value for ${flag}`);
return v;
} Try / catch
try { await autoresearchGoalCommand(argv); } catch (e) { if (e instanceof AutoresearchGoalError && e.message.startsWith('Missing value for')) printUsage(); else throw e; } Prevention
- Prefer --flag=value form in all scripted invocations
- Never let empty shell variables become flag values
When it happens
Trigger: Passing `--slug` as the last argument with no value, or `--slug --verdict pass` where the next token starts with '--'. The error names the offending flag in the message.
Common situations: Optional flags chained so one flag's value slot is consumed check fails (e.g. `--summary --artifact x`), scripts omitting a value when a variable is empty, or copy-paste editing that drops a value.
Related errors
- Unknown adapt argument: ${arg}
- Unknown adapt subcommand: ${subcommand}. Supported subcomman
- agents-init accepts at most one path argument.\n${AGENTS_INI
- unknown agents subcommand: ${subcommand}
- [ask] invalid --agent-prompt role "${role}". Expected lowerc
AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27).
Data as JSON: /api/errors/c1456e9d9e4ae382.
Report an issue: GitHub.