HKUDS/DeepTutor · error · ValueError
interaction_id {interaction.interaction_id!r} already belong
Error message
interaction_id {interaction.interaction_id!r} already belongs to another path What it means
Error "interaction_id {interaction.interaction_id!r} already belongs to another path" thrown in HKUDS/DeepTutor.
Source
Thrown at deeptutor/learning/storage.py:184
row = self._conn.execute(
f"""
SELECT * FROM mastery_interactions
WHERE path_id = ? AND status IN ({placeholders})
ORDER BY created_at DESC LIMIT 1
""", # nosec B608 - placeholders is a generated "?,?" list; every value is bound
(self.progress.book_id, *_ACTIVE_INTERACTION_STATES),
).fetchone()
return self._interaction_from_row(row)
def put_interaction(self, interaction: MasteryInteraction) -> None:
if interaction.path_id != self.progress.book_id:
raise ValueError("interaction path_id does not match transaction path")
existing = self._conn.execute(
"SELECT path_id, status FROM mastery_interactions WHERE interaction_id = ?",
(interaction.interaction_id,),
).fetchone()
if existing is not None and str(existing["path_id"]) != interaction.path_id:
raise ValueError(
f"interaction_id {interaction.interaction_id!r} already belongs to another path"
)
if existing is not None:
current_status = InteractionStatus(existing["status"])
if interaction.status not in _ALLOWED_INTERACTION_TRANSITIONS[current_status]:
raise LearningStoreError(
f"Invalid mastery interaction transition: "
f"{current_status.value} -> {interaction.status.value}"
)
now = time.time()
interaction.updated_at = now
self._conn.execute(
"""
INSERT INTO mastery_interactions (
interaction_id, path_id, status, question_json, session_id,
turn_id, user_answer, result_json, created_at, updated_at
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
ON CONFLICT(interaction_id) DO UPDATE SETView on GitHub (pinned to 3e82f13042)
When it happens
Trigger: Thrown at deeptutor/learning/storage.py:184 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27).
Data as JSON: /api/errors/3bc14715c2ecf524.
Report an issue: GitHub.