{"record":{"id":"bc09a99e85cd5d94","repo":"HKUDS/DeepTutor","slug":"pathleaseconflicterror-existing","errorCode":null,"errorMessage":"PathLeaseConflictError(existing)","messagePattern":"PathLeaseConflictError\\(existing\\)","errorType":"error_code","errorClass":"PathLeaseConflictError","httpStatus":null,"severity":"error","filePath":"deeptutor/learning/storage.py","lineNumber":871,"sourceCode":"        if not session_id or not turn_id:\n            raise ValueError(\"session_id and turn_id are required for a path lease\")\n        if bind_session:\n            self.bind_session(path_id, session_id, owns_path=False)\n        else:\n            # Administrative mutations need exclusion without creating a fake\n            # conversation association.\n            with self.transaction(path_id, create=True):\n                pass\n        now = time.time()\n        with self._connect() as conn:\n            conn.execute(\"BEGIN IMMEDIATE\")\n            try:\n                row = conn.execute(\n                    \"SELECT * FROM mastery_path_leases WHERE path_id = ?\", (path_id,)\n                ).fetchone()\n                existing = self._lease_from_row(row)\n                if existing is not None and existing.turn_id != turn_id:\n                    raise PathLeaseConflictError(existing)\n                conn.execute(\n                    \"\"\"\n                    INSERT INTO mastery_path_leases (path_id, session_id, turn_id, acquired_at)\n                    VALUES (?, ?, ?, ?)\n                    ON CONFLICT(path_id) DO UPDATE SET\n                        session_id = excluded.session_id,\n                        turn_id = excluded.turn_id,\n                        acquired_at = excluded.acquired_at\n                    \"\"\",\n                    (path_id, session_id, turn_id, now),\n                )\n                conn.commit()\n            except Exception:\n                conn.rollback()\n                raise\n        return MasteryPathLease(\n            path_id=path_id, session_id=session_id, turn_id=turn_id, acquired_at=now\n        )","sourceCodeStart":853,"sourceCodeEnd":889,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/learning/storage.py#L853-L889","documentation":"Error \"PathLeaseConflictError(existing)\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/learning/storage.py:871 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"}