HKUDS/DeepTutor · error · HTTPException

not a valid entry id

Error message

not a valid entry id

What it means

HTTP 404 raised by GET /resolve_entry/{entry_id} in deeptutor/api/routers/memory.py:107 when the scan of all seven L2 surface documents finds no entry matching the given m_<ULID> id. Either the id is malformed or the entry was removed; the workbench navigation target cannot be resolved.

Solutions

  1. Pass the full entry id exactly as cited by the L3 doc (m_ + 26 ULID characters)
  2. Verify the id was not truncated or lowercased in transit
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

    backups: list[str] = []
    if backup_dir.exists():
        backups = sorted(p.name for p in backup_dir.iterdir() if p.is_dir())
    return {"docs": rows, "backups": backups}


@router.get("/resolve_entry/{entry_id}")
async def resolve_entry(entry_id: str):
    """Find which L2 doc owns this entry id.

    L3 docs cite L2 entries by their ``m_<ULID>`` entry id; the workbench
    UI uses this resolver to turn an L3 footnote click into a navigation
    to the right L2 surface + scroll-to anchor.

    Scans the seven L2 mds in order; first hit wins. 404 if no L2 doc
    contains the id (e.g. the entry was deleted or the id is stale).
    """
    if not _ENTRY_ID_RE.match(entry_id):
        raise HTTPException(status_code=400, detail="not a valid entry id")
    from deeptutor.services.memory.document import parse

    for surface in SURFACES:
        path = paths.l2_file(surface)
        if not path.exists():
            continue
        try:
            doc = parse(path.read_text(encoding="utf-8"))
        except Exception:  # noqa: BLE001 — malformed L2 should not 500 the resolver
            continue
        for entry in doc.all_entries():
            if entry.id == entry_id:
                return {"layer": "L2", "key": surface, "entry_id": entry_id}
    raise HTTPException(status_code=404, detail="entry not found in any L2 doc")


@router.get("/backup")
async def list_backups():

View on GitHub (pinned to 3e82f13042)