{"record":{"id":"1a553094ee6e0221","repo":"HKUDS/DeepTutor","slug":"entry-not-found-in-any-l2-doc","errorCode":null,"errorMessage":"entry not found in any L2 doc","messagePattern":"entry not found in any L2 doc","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"deeptutor/api/routers/memory.py","lineNumber":121,"sourceCode":"    Scans the seven L2 mds in order; first hit wins. 404 if no L2 doc\n    contains the id (e.g. the entry was deleted or the id is stale).\n    \"\"\"\n    if not _ENTRY_ID_RE.match(entry_id):\n        raise HTTPException(status_code=400, detail=\"not a valid entry id\")\n    from deeptutor.services.memory.document import parse\n\n    for surface in SURFACES:\n        path = paths.l2_file(surface)\n        if not path.exists():\n            continue\n        try:\n            doc = parse(path.read_text(encoding=\"utf-8\"))\n        except Exception:  # noqa: BLE001 — malformed L2 should not 500 the resolver\n            continue\n        for entry in doc.all_entries():\n            if entry.id == entry_id:\n                return {\"layer\": \"L2\", \"key\": surface, \"entry_id\": entry_id}\n    raise HTTPException(status_code=404, detail=\"entry not found in any L2 doc\")\n\n\n@router.get(\"/backup\")\nasync def list_backups():\n    backup_dir = paths.backup_root()\n    if not backup_dir.exists():\n        return {\"backups\": []}\n    out: list[dict] = []\n    for entry in sorted(backup_dir.iterdir()):\n        if entry.is_dir():\n            files = sorted(p.name for p in entry.iterdir())\n            out.append({\"name\": entry.name, \"files\": files})\n    return {\"backups\": out}\n\n\n# ── Doc read / write / delete ────────────────────────────────────────────\n\n","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/api/routers/memory.py#L103-L139","documentation":"Error \"entry not found in any L2 doc\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/api/routers/memory.py:121 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"}