{"record":{"id":"d50cdb9884a0d996","repo":"HKUDS/DeepTutor","slug":"module-mod-id-r-must-contain-at-least-one-knowle","errorCode":null,"errorMessage":"Module {mod.id!r} must contain at least one knowledge point","messagePattern":"Module (.+?) must contain at least one knowledge point","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"deeptutor/api/routers/mastery_path.py","lineNumber":73,"sourceCode":"        m_clean = {k: v for k, v in m.items() if k != \"knowledge_points\"}\n        try:\n            modules.append(LearningModule(knowledge_points=kps, **m_clean))\n        except PydanticValidationError as exc:\n            raise HTTPException(\n                status_code=422,\n                detail=f\"Invalid module data in modules[{i}]: {exc.errors()}\",\n            ) from exc\n    return modules\n\n\ndef _validate_runnable_modules(modules: list[LearningModule], *, status_code: int = 400) -> None:\n    if not modules:\n        raise HTTPException(\n            status_code=status_code, detail=\"At least one learning module is required\"\n        )\n    for mod in modules:\n        if not mod.knowledge_points:\n            raise HTTPException(\n                status_code=status_code,\n                detail=f\"Module {mod.id!r} must contain at least one knowledge point\",\n            )\n\n\nasync def _cancel_active_learning_turn(book_id: str) -> None:\n    from deeptutor.services.session import get_turn_runtime_manager\n\n    learning_store = LearningStore()\n    runtime = get_turn_runtime_manager()\n    lease = await asyncio.to_thread(learning_store.get_path_lease, book_id)\n    if lease is not None:\n        if lease.session_id == \"__path_api__\":\n            # Another administrative mutation owns the path. The caller's\n            # acquisition attempt will return a deterministic HTTP 409.\n            return\n        await runtime.cancel_turn(lease.turn_id)\n        # ``cancel_turn`` can finalize a restart orphan without an in-memory","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/api/routers/mastery_path.py#L55-L91","documentation":"Error \"Module {mod.id!r} must contain at least one knowledge point\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/api/routers/mastery_path.py:73 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"}