{"record":{"id":"5366d26164f2149e","repo":"HKUDS/DeepTutor","slug":"cancel-the-active-run-before-resetting-this-doc","errorCode":null,"errorMessage":"cancel the active run before resetting this doc","messagePattern":"cancel the active run before resetting this doc","errorType":"http","errorClass":"HTTPException","httpStatus":409,"severity":"error","filePath":"deeptutor/api/routers/memory.py","lineNumber":187,"sourceCode":"@router.post(\"/doc/{layer}/{key}/reset\")\nasync def reset_doc(layer: str, key: str):\n    \"\"\"Wipe the doc + its meta sidecar so the next update starts fresh.\n\n    Destructive — the caller has confirmed. After this returns the .md\n    file is gone *and* the ``seen_entity_refs`` set is cleared, so a\n    subsequent ``run_update`` re-ingests every L1 entity instead of\n    treating them as already-seen.\n\n    Refuses while a consolidator run is active on this doc; the caller\n    can cancel first.\n    \"\"\"\n    lyr = _validate_layer(layer)\n    _validate_doc_key(lyr, key)\n\n    from deeptutor.services.memory.consolidator.runs import get_run_manager\n\n    if get_run_manager().active_for(lyr, key) is not None:\n        raise HTTPException(\n            status_code=409,\n            detail=\"cancel the active run before resetting this doc\",\n        )\n\n    from deeptutor.services.memory.consolidator import meta as meta_mod\n\n    doc_path = paths.l2_file(key) if lyr == \"L2\" else paths.l3_file(key)  # type: ignore[arg-type]\n    meta_path = (\n        meta_mod.l2_meta_path(key)  # type: ignore[arg-type]\n        if lyr == \"L2\"\n        else meta_mod.l3_meta_path(key)  # type: ignore[arg-type]\n    )\n\n    removed_doc = False\n    removed_meta = False\n    try:\n        if doc_path.exists():\n            doc_path.unlink()","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/api/routers/memory.py#L169-L205","documentation":"Error \"cancel the active run before resetting this doc\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/api/routers/memory.py:187 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"}