{"record":{"id":"7b38d2b85f242bc1","repo":"Yeachan-Heo/oh-my-codex","slug":"invalid-codex-goal-mode-expected-aggregate-or-p","errorCode":null,"errorMessage":"Invalid --codex-goal-mode; expected aggregate or per-story.","messagePattern":"Invalid --codex-goal-mode; expected aggregate or per-story\\.","errorType":"exception","errorClass":"UltragoalError","httpStatus":null,"severity":"error","filePath":"src/cli/ultragoal.ts","lineNumber":140,"sourceCode":"  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  }\n  return words.join(' ').trim();\n}\n\nfunction printJson(value: unknown): void {\n  console.log(JSON.stringify(value, null, 2));\n}\n\nfunction normalizeCodexGoalMode(raw: string | undefined): 'aggregate' | 'per_story' | undefined {\n  if (!raw) return undefined;\n  if (raw === 'aggregate') return 'aggregate';\n  if (raw === 'per-story' || raw === 'per_story') return 'per_story';\n  throw new UltragoalError('Invalid --codex-goal-mode; expected aggregate or per-story.');\n}\n\nfunction printStatus(plan: Awaited<ReturnType<typeof readUltragoalPlan>>): void {\n  const summary = summarizeUltragoalPlan(plan);\n  if (summary.aggregateComplete) {\n    console.log('ultragoal aggregate product: complete');\n    console.log(`microgoal ledger bookkeeping (progress-only): ${summary.complete}/${summary.total} complete, ${summary.pending} pending, ${summary.inProgress} in progress, ${summary.failed} failed, ${summary.reviewBlocked} review-blocked, ${summary.needsUserDecision} needs-user-decision`);\n  } else if (summary.artifactComplete) {\n    console.log('ultragoal artifact goals: complete');\n    console.log(`codex goal reconciliation: not recorded in OMX aggregateCompletion; status is artifact-backed until a fresh Codex goal snapshot is available.`);\n    console.log(`microgoal ledger: ${summary.complete}/${summary.total} complete, ${summary.pending} pending, ${summary.inProgress} in progress, ${summary.failed} failed, ${summary.reviewBlocked} review-blocked, ${summary.needsUserDecision} needs-user-decision`);\n  } else {\n    console.log(`ultragoal: ${summary.complete}/${summary.total} complete, ${summary.pending} pending, ${summary.inProgress} in progress, ${summary.failed} failed, ${summary.reviewBlocked} review-blocked, ${summary.needsUserDecision} needs-user-decision`);\n  }\n  for (const goal of plan.goals) {\n    const marker = goal.id === plan.activeGoalId ? '*' : '-';\n    console.log(`${marker} ${goal.id} [${goal.status}] ${goal.title}`);\n  }","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/ultragoal.ts#L122-L158","documentation":"The --codex-goal-mode flag for `omx ultragoal create` accepts only the strings 'aggregate', 'per-story', or 'per_story'. normalizeCodexGoalMode throws UltragoalError for anything else, including common guesses like 'perStory' or 'story'.","triggerScenarios":"Passing `--codex-goal-mode perStory` / `stories` / `none` / any string other than the three accepted spellings to `omx ultragoal create` (or create-goals).","commonSituations":"Guessing flag values from camelCase habit; typo 'per_story' vs 'per-store'; docs/README examples out of sync with the CLI's accepted enum.","solutions":["Use exactly `--codex-goal-mode aggregate` or `--codex-goal-mode per-story` (underscore `per_story` also accepted)","Omit the flag entirely if you want the default mode","Check `omx ultragoal --help` for the current enum values on your version"],"exampleFix":"# before\nomx ultragoal create --brief b.txt --codex-goal-mode perStory\n# Error: Invalid --codex-goal-mode; expected aggregate or per-story.\n\n# after\nomx ultragoal create --brief b.txt --codex-goal-mode per-story","handlingStrategy":"type-guard","validationCode":"const MODES = new Set(['aggregate', 'per-story', 'per_story'] as const);\nconst mode = process.env.UG_MODE;\nif (mode && !MODES.has(mode as any)) throw new Error(`bad mode ${mode}`);","typeGuard":"function isCodexGoalMode(v: string): v is 'aggregate' | 'per-story' | 'per_story' {\n  return v === 'aggregate' || v === 'per-story' || v === 'per_story';\n}","tryCatchPattern":null,"preventionTips":["Wrap mode values in a shell variable validated against the enum before invoking","Omit --codex-goal-mode unless you specifically need per-story behavior"],"tags":["cli","argument-validation","enum","ultragoal"],"backgroundTag":"invalid-cli-flag-value","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}