HKUDS/DeepTutor · error · LearningConflictError
LearningConflictError(path_id, int(progress.version), 0)
Error message
LearningConflictError(path_id, int(progress.version), 0)
What it means
Optimistic-concurrency failure in save(): the revision observed when re-reading the mastery_paths row doesn't match what was expected (here, against a baseline of 0), meaning another writer modified the path concurrently. LearningConflictError carries the path id, expected, and actual revisions.
Solutions
- Reload the LearningProgress, re-apply the change, and save again
- Serialize writers with a path lease (acquire_path_lease) to avoid concurrent revisions
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at deeptutor/learning/storage.py:472 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/73365401a124cc46.
Report an issue: GitHub.
Appendix: source
Thrown at deeptutor/learning/storage.py:472
row = conn.execute(
"SELECT * FROM mastery_paths WHERE path_id = ?", (path_id,)
).fetchone()
return self._progress_from_row(row) if row is not None else None
def save(self, progress: LearningProgress) -> None:
path_id = self._validate_id(progress.book_id)
self._import_legacy_if_needed(path_id)
now = time.time()
with self._connect() as conn:
conn.execute("BEGIN IMMEDIATE")
try:
row = conn.execute(
"SELECT revision, created_at FROM mastery_paths WHERE path_id = ?",
(path_id,),
).fetchone()
if row is None:
if int(progress.version) != 0:
raise LearningConflictError(path_id, int(progress.version), 0)
revision = 1
conn.execute(
"""
INSERT INTO mastery_paths (
path_id, state_json, revision, created_at, updated_at
) VALUES (?, ?, ?, ?, ?)
""",
(
path_id,
self._progress_payload(progress, revision, now),
revision,
progress.created_at,
now,
),
)
event_type = "path.created"
else:
actual = int(row["revision"])View on GitHub (pinned to 3e82f13042)