HKUDS/DeepTutor · error · HTTPException

entry not found

Error message

entry not found

What it means

DELETE /doc/{layer}/{key}/entry/{entry_id} resolved the layer and doc key, but the memory store's delete_entry reported that no entry with that id exists in the document — the id is stale or already removed.

Solutions

  1. Re-read the current doc content to get live entry ids before deleting
  2. Treat the 404 as success if the goal is simply that the entry be absent (idempotent delete)
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

class DocWriteRequest(BaseModel):
    content: str


@router.put("/doc/{layer}/{key}")
async def put_doc(layer: str, key: str, payload: DocWriteRequest):
    lyr = _validate_layer(layer)
    _validate_doc_key(lyr, key)
    await get_memory_store().overwrite_doc(lyr, key, payload.content)
    return {"layer": lyr, "key": key, "saved": True}


@router.delete("/doc/{layer}/{key}/entry/{entry_id}")
async def delete_entry(layer: str, key: str, entry_id: str):
    lyr = _validate_layer(layer)
    _validate_doc_key(lyr, key)
    ok = await get_memory_store().delete_entry(lyr, key, entry_id)
    if not ok:
        raise HTTPException(status_code=404, detail="entry not found")
    return {"layer": lyr, "key": key, "deleted": entry_id}


@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)

View on GitHub (pinned to 3e82f13042)