{"record":{"id":"f796b431e0431eec","repo":"HKUDS/DeepTutor","slug":"invalid-mastery-interaction-transition-current-s","errorCode":null,"errorMessage":"Invalid mastery interaction transition: {current_status.value} -> {interaction.status.value}","messagePattern":"Invalid mastery interaction transition: (.+?) -> (.+?)","errorType":"validation","errorClass":"LearningStoreError","httpStatus":null,"severity":"error","filePath":"deeptutor/learning/storage.py","lineNumber":190,"sourceCode":"            (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\n                status = excluded.status,\n                question_json = excluded.question_json,\n                session_id = excluded.session_id,\n                turn_id = excluded.turn_id,\n                user_answer = excluded.user_answer,\n                result_json = excluded.result_json,","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/learning/storage.py#L172-L208","documentation":"Error \"Invalid mastery interaction transition: {current_status.value} -> {interaction.status.value}\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/learning/storage.py:190 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"}