{"record":{"id":"c1456e9d9e4ae382","repo":"Yeachan-Heo/oh-my-codex","slug":"missing-value-for-flag-c1456e","errorCode":null,"errorMessage":"Missing value for ${flag}.","messagePattern":"Missing value for (.+?)\\.","errorType":"validation","errorClass":"AutoresearchGoalError","httpStatus":null,"severity":"error","filePath":"src/cli/autoresearch-goal.ts","lineNumber":52,"sourceCode":"\nGoal-mode boundary:\n  This command does not revive deprecated omx autoresearch and does not mutate hidden Codex /goal state.\n  It writes durable OMX artifacts and prints a model-facing handoff for get_goal/create_goal/update_goal.\n  Completion is blocked until professor-critic validation records verdict=pass.\n`;\n\nfunction hasFlag(args: readonly string[], flag: string): boolean {\n  return args.includes(flag);\n}\n\nfunction readValue(args: readonly string[], flag: string): string | undefined {\n  const prefix = `${flag}=`;\n  const inline = args.find((arg) => arg.startsWith(prefix));\n  if (inline !== undefined) return inline.slice(prefix.length);\n  const index = args.indexOf(flag);\n  if (index < 0) return undefined;\n  const value = args[index + 1];\n  if (!value || value.startsWith('--')) throw new AutoresearchGoalError(`Missing value for ${flag}.`);\n  return value;\n}\n\nasync function readMaybeFile(value: string | undefined): Promise<string | undefined> {\n  if (!value) return undefined;\n  if (value.startsWith('@')) return readFile(value.slice(1), 'utf-8');\n  return value;\n}\n\nfunction positionalText(args: readonly string[]): string {\n  const valueTaking = new Set(['--topic', '--rubric', '--critic-command', '--slug', '--verdict', '--evidence', '--summary', '--artifact', '--codex-goal-json']);\n  const words: string[] = [];\n  for (let i = 0; i < args.length; i++) {\n    const arg = args[i];\n    if (valueTaking.has(arg)) { i += 1; continue; }\n    if (arg.startsWith('--')) continue;\n    words.push(arg);\n  }","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/autoresearch-goal.ts#L34-L70","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nomx autoresearch-goal verdict --slug --verdict pass\n// after\nomx autoresearch-goal verdict --slug=my-goal --verdict pass","handlingStrategy":"validation","validationCode":"function readValueSafe(args: string[], flag: string): string | undefined {\n  const i = args.indexOf(flag);\n  if (i < 0) return undefined;\n  const v = args[i+1];\n  if (!v || v.startsWith('--')) throw new UsageError(`Missing value for ${flag}`);\n  return v;\n}","typeGuard":null,"tryCatchPattern":"try { await autoresearchGoalCommand(argv); } catch (e) { if (e instanceof AutoresearchGoalError && e.message.startsWith('Missing value for')) printUsage(); else throw e; }","preventionTips":["Prefer --flag=value form in all scripted invocations","Never let empty shell variables become flag values"],"tags":["cli","missing-flag-value","argument-parsing"],"backgroundTag":"missing-flag-value","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}