HKUDS/DeepTutor · error · HTTPException
layer must be L2 or L3
Error message
layer must be L2 or L3
What it means
HTTP 400 raised by _validate_layer in deeptutor/api/routers/memory.py:71 when a memory endpoint receives a layer string other than 'L2' or 'L3'. Memory workbench documents only exist at those two layers, so the layer path/query parameter is rejected before any doc lookup.
Solutions
- Pass layer as exactly 'L2' or 'L3' (case-sensitive) in the URL
- Check for trailing whitespace or URL-encoding artifacts in the path segment
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at deeptutor/api/routers/memory.py:71 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/1a039e5e61d329da.
Report an issue: GitHub.
Appendix: source
Thrown at deeptutor/api/routers/memory.py:71
logger = logging.getLogger(__name__)
router = APIRouter()
Layer = Literal["L2", "L3"]
# ── Helpers ──────────────────────────────────────────────────────────────
def _validate_doc_key(layer: Layer, key: str) -> None:
if layer == "L2" and key not in SURFACES:
raise HTTPException(status_code=404, detail=f"unknown surface {key!r}")
if layer == "L3" and key not in L3_SLOTS:
raise HTTPException(status_code=404, detail=f"unknown L3 slot {key!r}")
def _validate_layer(layer: str) -> Layer:
if layer not in {"L2", "L3"}:
raise HTTPException(status_code=400, detail="layer must be L2 or L3")
return layer # type: ignore[return-value]
def _validate_surface(surface: str) -> Surface:
if surface not in SURFACES:
raise HTTPException(status_code=404, detail=f"unknown surface {surface!r}")
return surface # type: ignore[return-value]
# ── Overview / list ──────────────────────────────────────────────────────
@router.get("/overview")
async def get_overview():
store = get_memory_store()
rows = [asdict(r) for r in store.overview()]
backup_dir = paths.backup_root()
backups: list[str] = []View on GitHub (pinned to 3e82f13042)