{"record":{"id":"df7a6f270370dfbc","repo":"Yeachan-Heo/oh-my-codex","slug":"answer-question-id-requires-answer","errorCode":null,"errorMessage":"--answer-question-id requires --answer","messagePattern":"--answer-question-id requires --answer","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/question.ts","lineNumber":254,"sourceCode":"      : { clearReason: 'error' },\n  );\n}\n\nexport async function questionCommand(args: string[]): Promise<void> {\n  const parsed = parseQuestionArgs(args);\n  if (parsed.help || args.length === 0) {\n    console.log(QUESTION_HELP);\n    return;\n  }\n\n  if (parsed.ui) {\n    if (!parsed.statePath) throw new Error('--ui requires --state-path');\n    await runQuestionUi(parsed.statePath);\n    return;\n  }\n\n  if (parsed.answerQuestionId) {\n    if (!parsed.answer) throw new Error('--answer-question-id requires --answer');\n    let answerPayload: unknown;\n    try {\n      answerPayload = JSON.parse(parsed.answer);\n    } catch (error) {\n      throw new Error(`--answer must be valid JSON: ${(error as Error).message}`);\n    }\n    try {\n      const { record, recordPath } = await submitQuestionAnswerById(\n        process.cwd(),\n        parsed.answerQuestionId,\n        answerPayload,\n        { sessionId: parsed.sessionId },\n      );\n      printJson({\n        ok: true,\n        question_id: record.question_id,\n        session_id: record.session_id,\n        status: record.status,","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/question.ts#L236-L272","documentation":"Thrown by the omx question CLI when --answer-question-id is provided without --answer. Answering a recorded question by ID requires the answer payload, so the command refuses to run with only half of the pair.","triggerScenarios":"Running `omx question --answer-question-id <id>` without also passing `--answer <json>`, i.e. parsed.answerQuestionId is truthy while parsed.answer is empty.","commonSituations":"Shell scripts that pass the question ID but forget the answer, quoting bugs that swallow the --answer value, or copy-pasting an example command that omits the flag.","solutions":["Add the --answer flag with a JSON payload: `omx question --answer-question-id <id> --answer '{\"choice\":\"yes\"}'`","Verify flag names with `omx question --help` — a typo like --answers is silently ignored","If scripting, check both flags are set before invoking the CLI"],"exampleFix":"# before\nomx question --answer-question-id q_123\n# after\nomx question --answer-question-id q_123 --answer '{\"choice\":\"yes\"}'","handlingStrategy":"validation","validationCode":"const args = ['question', '--answer-question-id', id];\nif (!answerJson || !answerJson.trim()) {\n  throw new Error('answer payload is required when answering a question');\n}\nargs.push('--answer', answerJson);\nawait runQuestionCli(args);","typeGuard":"function hasCompleteAnswerFlags(parsed: { answerQuestionId?: string; answer?: string }): boolean {\n  return !parsed.answerQuestionId || Boolean(parsed.answer && parsed.answer.length > 0);\n}","tryCatchPattern":null,"preventionTips":["Always set --answer and --answer-question-id together","In wrappers, assert both values are non-empty before spawning the CLI","Keep an integration test that exercises the answer path"],"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"}