HKUDS/DeepTutor · error · HTTPException

cancel the active run before resetting this doc

Error message

cancel the active run before resetting this doc

What it means

Conflict guard on POST /doc/{layer}/{key}/reset: a consolidator run is currently active on this doc, so the destructive wipe is refused to avoid deleting files the running dedup/merge is reading and writing.

Solutions

  1. Cancel the active run (POST /runs/{id}/cancel) and retry the reset
  2. Wait for the run to finish, then reset
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at deeptutor/api/routers/memory.py:187 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/5366d26164f2149e. Report an issue: GitHub.

Appendix: source

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

@router.post("/doc/{layer}/{key}/reset")
async def reset_doc(layer: str, key: str):
    """Wipe the doc + its meta sidecar so the next update starts fresh.

    Destructive — the caller has confirmed. After this returns the .md
    file is gone *and* the ``seen_entity_refs`` set is cleared, so a
    subsequent ``run_update`` re-ingests every L1 entity instead of
    treating them as already-seen.

    Refuses while a consolidator run is active on this doc; the caller
    can cancel first.
    """
    lyr = _validate_layer(layer)
    _validate_doc_key(lyr, key)

    from deeptutor.services.memory.consolidator.runs import get_run_manager

    if get_run_manager().active_for(lyr, key) is not None:
        raise HTTPException(
            status_code=409,
            detail="cancel the active run before resetting this doc",
        )

    from deeptutor.services.memory.consolidator import meta as meta_mod

    doc_path = paths.l2_file(key) if lyr == "L2" else paths.l3_file(key)  # type: ignore[arg-type]
    meta_path = (
        meta_mod.l2_meta_path(key)  # type: ignore[arg-type]
        if lyr == "L2"
        else meta_mod.l3_meta_path(key)  # type: ignore[arg-type]
    )

    removed_doc = False
    removed_meta = False
    try:
        if doc_path.exists():
            doc_path.unlink()

View on GitHub (pinned to 3e82f13042)