{"record":{"id":"04f708e9f741f592","repo":"HKUDS/DeepTutor","slug":"choice-expected-answer-must-be-an-option-label-suc","errorCode":null,"errorMessage":"Choice expected_answer must be an option label such as A/B/C/D, or uniquely match one full option body. Retry mastery_quiz with the correct label.","messagePattern":"Choice expected_answer must be an option label such as A/B/C/D, or uniquely match one full option body\\. Retry mastery_quiz with the correct label\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"deeptutor/capabilities/mastery/tools.py","lineNumber":211,"sourceCode":"            \"learner would be shown identical choices. Retry mastery_quiz with one \"\n            \"distinct body per option.\"\n        )\n    if not has_option_bodies(choice_options):\n        raise ValueError(\n            \"Choice questions need full option bodies in mastery_quiz.options \"\n            \"(for example ['A: first answer', 'B: second answer']), not only \"\n            \"the labels A/B/C/D. Retry mastery_quiz with the exact option \"\n            \"descriptions you will show through ask_user.\"\n        )\n    normalized_bodies = {\" \".join(body.split()).casefold() for body in choice_options.values()}\n    if len(normalized_bodies) != len(choice_options):\n        raise ValueError(\n            \"Choice option bodies must be unique; retry mastery_quiz with \"\n            \"distinct answer text for every option.\"\n        )\n    resolved_expected = resolve_answer(expected_answer, choice_options)\n    if not resolved_expected:\n        raise ValueError(\n            \"Choice expected_answer must be an option label such as A/B/C/D, \"\n            \"or uniquely match one full option body. Retry mastery_quiz with \"\n            \"the correct label.\"\n        )\n    return question_type, format_options(choice_options), resolved_expected\n\n\nasync def _resolve_pending_choice(\n    pending: PendingQuestion, turn_id: str\n) -> tuple[dict[str, str], str]:\n    \"\"\"Resolve a pending choice question's ``({label: body}, expected_label)``.\n\n    The persisted options are authoritative. For legacy paths that stored only\n    ``[\"A\", \"B\", ...]`` it recovers the real bodies from the turn's\n    ``ask_user`` event. The expected answer is normalised to a stable label\n    when it resolves, else left as registered.\n    \"\"\"\n    options = parse_options(list(pending.options or []))","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/capabilities/mastery/tools.py#L193-L229","documentation":"Error \"Choice expected_answer must be an option label such as A/B/C/D, or uniquely match one full option body. Retry mastery_quiz with the correct label.\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/capabilities/mastery/tools.py:211 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}