HKUDS/DeepTutor · error · PathBindingError

No mastery path exists. Call mastery_paths for the ids you…

Error message

No mastery path {path_id!r} exists. Call mastery_paths for the ids you can switch to, or mastery_build to create one here.

What it means

Existence guard in rebind_active_path: after sanitizing, the mastery path id is not in the learning store (require_existing=True), so switching onto it is refused; the message points at mastery_paths/mastery_build as the discovery/creation routes.

Solutions

  1. Call mastery_paths to list valid ids before switching
  2. Call mastery_build to create the path in this conversation
  3. Check for typos — the id is sanitized but must match an existing path
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at deeptutor/capabilities/mastery/binding.py:63 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/d66c2b821690fca9. Report an issue: GitHub.

Appendix: source

Thrown at deeptutor/capabilities/mastery/binding.py:63

    session_id: str,
    turn_id: str,
    bind_turn: PathBinder | None,
    require_existing: bool = True,
) -> str:
    """Move this turn (and the conversation) onto ``path_id``.

    Returns the resolved path id. Raises :class:`PathBindingError` when the
    target does not exist or is busy in another conversation.
    """
    from deeptutor.learning.storage import (
        LearningStore,
        PathLeaseConflictError,
    )

    target = sanitize_mastery_path_id(path_id)
    store = LearningStore()
    if require_existing and not await asyncio.to_thread(store.exists, target):
        raise PathBindingError(
            f"No mastery path {path_id!r} exists. Call mastery_paths for the "
            "ids you can switch to, or mastery_build to create one here."
        )

    # One lease row per turn: the old one has to go before the new one can be
    # taken, and both are scoped to this turn so a concurrent conversation on
    # either path is never disturbed.
    released = await asyncio.to_thread(store.release_leases_for_turn, turn_id)
    try:
        await asyncio.to_thread(store.acquire_path_lease, target, session_id, turn_id)
    except PathLeaseConflictError as exc:
        # Put the learner back where they were rather than stranding the turn
        # with no lease at all.
        if released and released != target:
            with contextlib.suppress(Exception):
                await asyncio.to_thread(store.acquire_path_lease, released, session_id, turn_id)
        raise PathBindingError(
            f"Mastery path {target!r} is being tutored in another conversation "

View on GitHub (pinned to 3e82f13042)