{"record":{"id":"f37f69630cdc5d92","repo":"HKUDS/DeepTutor","slug":"mastery-path-changed-activity-while-the-operation","errorCode":null,"errorMessage":"Mastery path changed activity while the operation was starting; active session: {exc.lease.session_id}","messagePattern":"Mastery path changed activity while the operation was starting; active session: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":409,"severity":"error","filePath":"deeptutor/api/routers/mastery_path.py","lineNumber":127,"sourceCode":"\n@asynccontextmanager\nasync def _exclusive_path_mutation(book_id: str):\n    \"\"\"Cancel the tutor, then exclude a newly racing tutor/API write.\"\"\"\n    from deeptutor.learning.storage import PathLeaseConflictError\n\n    await _cancel_active_learning_turn(book_id)\n    store = LearningStore()\n    operation_id = f\"api-{uuid.uuid4().hex}\"\n    try:\n        await asyncio.to_thread(\n            store.acquire_path_lease,\n            book_id,\n            \"__path_api__\",\n            operation_id,\n            bind_session=False,\n        )\n    except PathLeaseConflictError as exc:\n        raise HTTPException(\n            status_code=409,\n            detail=(\n                \"Mastery path changed activity while the operation was starting; \"\n                f\"active session: {exc.lease.session_id}\"\n            ),\n        ) from exc\n    try:\n        yield\n    finally:\n        await asyncio.to_thread(\n            store.release_path_lease,\n            book_id,\n            turn_id=operation_id,\n        )\n\n\n# ── Request models ───────────────────────────────────────────────────────────\n","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/api/routers/mastery_path.py#L109-L145","documentation":"Error \"Mastery path changed activity while the operation was starting; active session: {exc.lease.session_id}\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/api/routers/mastery_path.py:127 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"}