HKUDS/DeepTutor · error · HTTPException
Knowledge base '{requested}' not found
Error message
Knowledge base '{requested}' not found What it means
Raised by _resolve_registered_kb_name when a requested KB name is not among the registered knowledge bases and is not a default alias. HTTP 404; distinct from 154 in that a concrete name was given and simply does not exist.
Source
Thrown at deeptutor/api/routers/knowledge.py:771
f"Unsupported: {', '.join(unsupported[:5])}."
),
)
def _resolve_registered_kb_name(manager: KnowledgeBaseManager, kb_name: str | None) -> str:
"""Resolve route-level default aliases to the configured default KB."""
requested = str(kb_name or "").strip()
kb_names = manager.list_knowledge_bases()
if requested and requested in kb_names:
return requested
if requested.lower() in DEFAULT_KB_ALIASES:
default_kb = manager.get_default()
if default_kb and default_kb in kb_names:
return default_kb
raise HTTPException(status_code=404, detail="No default knowledge base is configured")
raise HTTPException(status_code=404, detail=f"Knowledge base '{requested}' not found")
def _load_kb_entry_or_404(manager: KnowledgeBaseManager, kb_name: str) -> dict:
manager.config = manager._load_config()
kb_entry = manager.config.get("knowledge_bases", {}).get(kb_name)
if kb_entry is None:
raise HTTPException(status_code=404, detail=f"Knowledge base '{kb_name}' not found")
return kb_entry
def _assert_not_connected_kb(kb_name: str, kb_entry: dict) -> None:
"""Block writes to connected KBs (Obsidian vaults, linked indexes).
They are read-only pointers to the user's external files — we never write
into or re-index them.
"""
if is_connected_kb(kb_entry):
raise HTTPException(View on GitHub (pinned to 3e82f13042)
Solutions
- List KBs via the API (GET knowledge bases) and copy the exact name
- Recreate the KB if it was deleted
- Verify the server is running with the expected data directory/settings profile
Example fix
# before kb = 'MyKB ' # trailing space / typo # after kb = 'my-kb'
Defensive patterns
Strategy: validation
Validate before calling
names = {kb['name'] for kb in client.get('/api/v1/knowledge').json()['knowledge_bases']}
assert kb_name in names, f'unknown KB {kb_name}' Type guard
def kb_exists(name: str, kb_list) -> bool:
return name in {kb['name'] for kb in kb_list} Try / catch
try: use_kb(name)
except HTTPError as e:
if e.response.status_code == 404: refresh_kb_cache(); reselect_kb() Prevention
- Refresh the KB list before acting on cached names
- Copy names exactly (case-sensitive) from the API
- Handle 404 by re-fetching rather than blind retry
When it happens
Trigger: Calling KB-scoped endpoints with a typo'd or deleted KB name, or a name registered in a different settings profile/config than the one the server loaded.
Common situations: KB deleted from another session; case-mismatched names; server restarted against a different data directory so the config no longer lists the KB.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- No default knowledge base is configured
- Knowledge base '{kb_name}' not found
- Knowledge base '{name}' not found
- Knowledge base '{requested}' not found
- Operation not found
AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27).
Data as JSON: /api/errors/9e1bf0df2373aab4.
Report an issue: GitHub.