HKUDS/DeepTutor · error · HTTPException

Module {mod.id!r} must contain at least one knowledge point

Error message

Module {mod.id!r} must contain at least one knowledge point

What it means

Error "Module {mod.id!r} must contain at least one knowledge point" thrown in HKUDS/DeepTutor.

Source

Thrown at deeptutor/api/routers/mastery_path.py:73

        m_clean = {k: v for k, v in m.items() if k != "knowledge_points"}
        try:
            modules.append(LearningModule(knowledge_points=kps, **m_clean))
        except PydanticValidationError as exc:
            raise HTTPException(
                status_code=422,
                detail=f"Invalid module data in modules[{i}]: {exc.errors()}",
            ) from exc
    return modules


def _validate_runnable_modules(modules: list[LearningModule], *, status_code: int = 400) -> None:
    if not modules:
        raise HTTPException(
            status_code=status_code, detail="At least one learning module is required"
        )
    for mod in modules:
        if not mod.knowledge_points:
            raise HTTPException(
                status_code=status_code,
                detail=f"Module {mod.id!r} must contain at least one knowledge point",
            )


async def _cancel_active_learning_turn(book_id: str) -> None:
    from deeptutor.services.session import get_turn_runtime_manager

    learning_store = LearningStore()
    runtime = get_turn_runtime_manager()
    lease = await asyncio.to_thread(learning_store.get_path_lease, book_id)
    if lease is not None:
        if lease.session_id == "__path_api__":
            # Another administrative mutation owns the path. The caller's
            # acquisition attempt will return a deterministic HTTP 409.
            return
        await runtime.cancel_turn(lease.turn_id)
        # ``cancel_turn`` can finalize a restart orphan without an in-memory

View on GitHub (pinned to 3e82f13042)

When it happens

Trigger: Thrown at deeptutor/api/routers/mastery_path.py:73 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/d50cdb9884a0d996. Report an issue: GitHub.