HKUDS/DeepTutor · error · RuntimeError

Question extraction output not found

Error message

Question extraction output not found

What it means

Raised by _parse_sync when no *_questions.json file exists in questions_dir even after running extract_questions_from_paper. Distinct from extraction failure: the extractor ran but wrote nothing (or wrote outside the expected output_base directory).

Solutions

  1. Verify extract_questions_from_paper returned success and where it wrote its output
  2. Check output_base permissions and disk space
  3. Ensure the extractor's output filename convention matches the *_questions.json glob
  4. Re-run with logging enabled to see whether extraction found any questions
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at deeptutor/agents/question/mimic_source.py:125 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27). Data as JSON: /api/errors/8c61d57541410791. Report an issue: GitHub.

Appendix: source

Thrown at deeptutor/agents/question/mimic_source.py:125

        # Shared parse layer: cached + engine-pluggable (the active engine is
        # selected in Settings → Document Parsing). Returns the cache dir with
        # the parsed artifacts; the questions JSON goes to the session output
        # dir so it never pollutes the shared parse cache.
        doc = get_parse_service().parse(paper_path, on_output=progress_callback)
        working_dir = doc.workdir or paper_path
        questions_dir = output_base

    json_files = list(questions_dir.glob("*_questions.json"))
    if not json_files:
        ok = extract_questions_from_paper(
            str(working_dir),
            output_dir=None if questions_dir == working_dir else str(questions_dir),
        )
        if not ok:
            raise RuntimeError("Failed to extract questions from parsed exam")
        json_files = list(questions_dir.glob("*_questions.json"))
    if not json_files:
        raise RuntimeError("Question extraction output not found")

    with json_files[0].open(encoding="utf-8") as fh:
        payload = json.load(fh)
    questions = payload.get("questions") or []
    if max_questions > 0:
        questions = questions[:max_questions]

    templates: list[QuizTemplate] = []
    for idx, item in enumerate(questions, 1):
        if not isinstance(item, dict):
            continue
        q_text = str(item.get("question_text") or "").strip()
        if not q_text:
            continue
        templates.append(
            QuizTemplate(
                question_id=f"q_{idx}",
                topic=q_text[:_TOPIC_CLIP_CHARS],

View on GitHub (pinned to 3e82f13042)