{"record":{"id":"0c1d4833bee4bfef","repo":"HKUDS/DeepTutor","slug":"mastery-path-target-r-is-being-tutored-in-anothe","errorCode":null,"errorMessage":"Mastery path {target!r} is being tutored in another conversation right now (session {exc.lease.session_id!r}). Try again once that turn finishes.","messagePattern":"Mastery path (.+?) is being tutored in another conversation right now \\(session (.+?)\\)\\. Try again once that turn finishes\\.","errorType":"exception","errorClass":"PathBindingError","httpStatus":null,"severity":"error","filePath":"deeptutor/capabilities/mastery/binding.py","lineNumber":80,"sourceCode":"    if require_existing and not await asyncio.to_thread(store.exists, target):\n        raise PathBindingError(\n            f\"No mastery path {path_id!r} exists. Call mastery_paths for the \"\n            \"ids you can switch to, or mastery_build to create one here.\"\n        )\n\n    # One lease row per turn: the old one has to go before the new one can be\n    # taken, and both are scoped to this turn so a concurrent conversation on\n    # either path is never disturbed.\n    released = await asyncio.to_thread(store.release_leases_for_turn, turn_id)\n    try:\n        await asyncio.to_thread(store.acquire_path_lease, target, session_id, turn_id)\n    except PathLeaseConflictError as exc:\n        # Put the learner back where they were rather than stranding the turn\n        # with no lease at all.\n        if released and released != target:\n            with contextlib.suppress(Exception):\n                await asyncio.to_thread(store.acquire_path_lease, released, session_id, turn_id)\n        raise PathBindingError(\n            f\"Mastery path {target!r} is being tutored in another conversation \"\n            f\"right now (session {exc.lease.session_id!r}). Try again once that \"\n            \"turn finishes.\"\n        ) from exc\n\n    _apply(bind_turn, target)\n    await _remember_on_session(session_id, target)\n    return target\n\n\nasync def leave_active_path(\n    *,\n    session_id: str,\n    turn_id: str,\n    bind_turn: PathBinder | None,\n) -> str:\n    \"\"\"Detach the conversation from any named path.\n","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/capabilities/mastery/binding.py#L62-L98","documentation":"Lease-conflict translation in rebind_active_path: PathLeaseConflictError fired because another conversation currently holds the tutoring lease on the target path (one active tutor per path). The message names the conflicting session so the caller knows where it is busy.","triggerScenarios":"Thrown at deeptutor/capabilities/mastery/binding.py:80 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry once the other conversation's turn finishes","Close or end the session holding the lease, then rebind","Switch to a different mastery path if the conflict persists"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","contentChangedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}