HKUDS/DeepTutor · error · HTTPException

{OSError message}

Error message

{OSError message}

What it means

Server-side failure in clear_trace_day: the per-day trace JSONL file was found but path.unlink() raised an OSError (permissions, read-only filesystem, or the file is held open by a writer/reader), so the day's trace could not be deleted.

Solutions

  1. Check the OSError detail for the failing path and fix permissions
  2. Retry after the process holding the file (active trace writer or reader) releases it
  3. If the unlink is transiently blocked, treat removal as best-effort and retry later
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at deeptutor/api/routers/memory.py:721 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/80bebbae91d88d8d. Report an issue: GitHub.

Appendix: source

Thrown at deeptutor/api/routers/memory.py:721

        except OSError:
            continue
    return {"surface": surf, "removed_files": removed}


@router.delete("/trace/{surface}/day/{day}")
async def clear_trace_day(surface: str, day: str):
    surf = _validate_surface(surface)
    try:
        parsed = date_cls.fromisoformat(day)
    except ValueError:
        raise HTTPException(status_code=400, detail="day must be YYYY-MM-DD")
    path = paths.trace_file(surf, parsed)
    if not path.exists():
        raise HTTPException(status_code=404, detail="no trace for that day")
    try:
        path.unlink()
    except OSError as exc:
        raise HTTPException(status_code=500, detail=str(exc))
    return {"surface": surf, "day": day, "deleted": True}


# ── Snapshot (L1 workspace mirror) ───────────────────────────────────────


@router.get("/snapshot/{surface}")
async def get_snapshot(surface: str):
    """Return the current entity list for ``surface`` from workspace.

    Snapshot is always derived live from workspace at call time. The response
    also includes ``pending_changes`` — the diff vs the last persisted state.
    Refresh commits these pending changes into ``changes.jsonl``.
    """
    surf = _validate_surface(surface)
    from deeptutor.services.memory import snapshot as snap

    entities = snap.read_snapshot(surf)

View on GitHub (pinned to 3e82f13042)