{"record":{"id":"c214cc0c29646b53","repo":"Yeachan-Heo/oh-my-codex","slug":"omx-question-requires-input-in-normal-mode","errorCode":null,"errorMessage":"omx question requires --input in normal mode","messagePattern":"omx question requires --input in normal mode","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/question.ts","lineNumber":292,"sourceCode":"        record_path: recordPath,\n      }, parsed.json);\n    } catch (error) {\n      const code = error instanceof QuestionSubmitError ? error.code : 'question_submit_failed';\n      printJson({\n        ok: false,\n        question_id: parsed.answerQuestionId,\n        session_id: parsed.sessionId,\n        error: {\n          code,\n          message: extractErrorMessage(error),\n        },\n      }, parsed.json);\n      process.exitCode = 1;\n    }\n    return;\n  }\n\n  if (!parsed.input) throw new Error('omx question requires --input in normal mode');\n\n  let rawInput: unknown;\n  try {\n    rawInput = JSON.parse(parsed.input);\n  } catch (error) {\n    throw new Error(`--input must be valid JSON: ${(error as Error).message}`);\n  }\n\n  const input = normalizeQuestionInput(rawInput);\n  const cwd = process.cwd();\n  const policy = await evaluateQuestionPolicy({\n    cwd,\n    explicitSessionId: input.session_id,\n    questionSource: input.source,\n  });\n  if (!policy.allowed) {\n    printJson({\n      ok: false,","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/question.ts#L274-L310","documentation":"The question command's normal (non-UI, non-answer) mode requires an --input flag containing the question specification JSON. Without it there is nothing to normalize or evaluate, so the command aborts.","triggerScenarios":"Running `omx question` with no flags, or only flags like --json/--state-path combos that skip the earlier UI and answer branches, leaving parsed.input empty at src/cli/question.ts:292.","commonSituations":"Assuming question runs interactively without input, forgetting --input after drafting a question spec, or a wrapper script dropping the argument.","solutions":["Pass --input with the question spec JSON: `omx question --input '{...}'`","Run `omx question --help` to see the expected modes (UI needs --ui + --state-path; answering needs --answer-question-id + --answer)","Validate the built argument list in scripts before invoking"],"exampleFix":"# before\nomx question\n# after\nomx question --input '{\"question\":\"Deploy?\",\"choices\":[\"yes\",\"no\"]}'","handlingStrategy":"validation","validationCode":"if (mode !== 'ui' && mode !== 'answer' && !inputJson) {\n  throw new Error('normal question mode requires --input');\n}\nconst argv = ['question', '--input', JSON.stringify(questionSpec)];","typeGuard":"type QuestionMode =\n  | { kind: 'ui'; statePath: string }\n  | { kind: 'answer'; id: string; answer: unknown }\n  | { kind: 'normal'; input: unknown };\n\nfunction resolveMode(p: ParsedArgs): QuestionMode | null {\n  if (p.statePath) return { kind: 'ui', statePath: p.statePath };\n  if (p.answerQuestionId) return { kind: 'answer', id: p.answerQuestionId, answer: p.answer };\n  if (p.input) return { kind: 'normal', input: p.input };\n  return null;\n}","tryCatchPattern":null,"preventionTips":["Decide the question mode explicitly before building argv","Centralize CLI invocation in one helper that guarantees --input for normal mode","Add a smoke test for each question mode"],"tags":["cli","missing-argument","question","validation"],"backgroundTag":"missing-cli-flag","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}