{"record":{"id":"3bc14715c2ecf524","repo":"HKUDS/DeepTutor","slug":"interaction-id-interaction-interaction-id-r-alre","errorCode":null,"errorMessage":"interaction_id {interaction.interaction_id!r} already belongs to another path","messagePattern":"interaction_id (.+?) already belongs to another path","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"deeptutor/learning/storage.py","lineNumber":184,"sourceCode":"        row = self._conn.execute(\n            f\"\"\"\n            SELECT * FROM mastery_interactions\n            WHERE path_id = ? AND status IN ({placeholders})\n            ORDER BY created_at DESC LIMIT 1\n            \"\"\",  # nosec B608 - placeholders is a generated \"?,?\" list; every value is bound\n            (self.progress.book_id, *_ACTIVE_INTERACTION_STATES),\n        ).fetchone()\n        return self._interaction_from_row(row)\n\n    def put_interaction(self, interaction: MasteryInteraction) -> None:\n        if interaction.path_id != self.progress.book_id:\n            raise ValueError(\"interaction path_id does not match transaction path\")\n        existing = self._conn.execute(\n            \"SELECT path_id, status FROM mastery_interactions WHERE interaction_id = ?\",\n            (interaction.interaction_id,),\n        ).fetchone()\n        if existing is not None and str(existing[\"path_id\"]) != interaction.path_id:\n            raise ValueError(\n                f\"interaction_id {interaction.interaction_id!r} already belongs to another path\"\n            )\n        if existing is not None:\n            current_status = InteractionStatus(existing[\"status\"])\n            if interaction.status not in _ALLOWED_INTERACTION_TRANSITIONS[current_status]:\n                raise LearningStoreError(\n                    f\"Invalid mastery interaction transition: \"\n                    f\"{current_status.value} -> {interaction.status.value}\"\n                )\n        now = time.time()\n        interaction.updated_at = now\n        self._conn.execute(\n            \"\"\"\n            INSERT INTO mastery_interactions (\n                interaction_id, path_id, status, question_json, session_id,\n                turn_id, user_answer, result_json, created_at, updated_at\n            ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n            ON CONFLICT(interaction_id) DO UPDATE SET","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/learning/storage.py#L166-L202","documentation":"Error \"interaction_id {interaction.interaction_id!r} already belongs to another path\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/learning/storage.py:184 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"}