{"record":{"id":"b6e3054d83bc5668","repo":"HKUDS/DeepTutor","slug":"failed-to-extract-questions-from-parsed-exam","errorCode":null,"errorMessage":"Failed to extract questions from parsed exam","messagePattern":"Failed to extract questions from parsed exam","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"deeptutor/agents/question/mimic_source.py","lineNumber":122,"sourceCode":"        working_dir = paper_path\n        questions_dir = working_dir\n    else:\n        # Shared parse layer: cached + engine-pluggable (the active engine is\n        # selected in Settings → Document Parsing). Returns the cache dir with\n        # the parsed artifacts; the questions JSON goes to the session output\n        # dir so it never pollutes the shared parse cache.\n        doc = get_parse_service().parse(paper_path, on_output=progress_callback)\n        working_dir = doc.workdir or paper_path\n        questions_dir = output_base\n\n    json_files = list(questions_dir.glob(\"*_questions.json\"))\n    if not json_files:\n        ok = extract_questions_from_paper(\n            str(working_dir),\n            output_dir=None if questions_dir == working_dir else str(questions_dir),\n        )\n        if not ok:\n            raise RuntimeError(\"Failed to extract questions from parsed exam\")\n        json_files = list(questions_dir.glob(\"*_questions.json\"))\n    if not json_files:\n        raise RuntimeError(\"Question extraction output not found\")\n\n    with json_files[0].open(encoding=\"utf-8\") as fh:\n        payload = json.load(fh)\n    questions = payload.get(\"questions\") or []\n    if max_questions > 0:\n        questions = questions[:max_questions]\n\n    templates: list[QuizTemplate] = []\n    for idx, item in enumerate(questions, 1):\n        if not isinstance(item, dict):\n            continue\n        q_text = str(item.get(\"question_text\") or \"\").strip()\n        if not q_text:\n            continue\n        templates.append(","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/agents/question/mimic_source.py#L104-L140","documentation":"Error \"Failed to extract questions from parsed exam\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/agents/question/mimic_source.py:122 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"}