HKUDS/DeepTutor · error · HTTPException
Unknown agent kind: {kind!r}
Error message
Unknown agent kind: {kind!r} What it means
Raised by the subagent model-sync endpoint when the requested agent kind has no registered backend, or the backend is not a local CLI (partners run their own model catalog). Only local CLI subagents expose a model catalog that DeepTutor can sync.
Source
Thrown at deeptutor/api/routers/subagents.py:92
options = await list_backend_options()
return {"backends": [o.to_dict() for o in options]}
@router.post("/backends/{kind}/sync")
async def sync_backend(kind: str):
"""Re-pull one backend's model catalog (the settings "sync" button).
For Claude Code this scrapes its ``/model`` TUI live and caches the result;
for Codex it re-reads the CLI-maintained cache.
"""
from deeptutor.services.subagent import get_backend
from deeptutor.services.subagent.models import sync_backend_options
backend = get_backend(kind)
if backend is None or not getattr(backend, "local_cli", True):
# Only local CLIs have a model catalog to sync; partners run their own.
raise HTTPException(status_code=400, detail=f"Unknown agent kind: {kind!r}")
options = await sync_backend_options(kind)
return options.to_dict()
@router.get("/partners")
async def list_visible_partners():
"""Partners the current user can connect & consult.
Returns every partner for an admin, or just the ones an admin has assigned
for a non-admin. The partner CRUD API (``/api/v1/partners``) stays fully
admin-gated; this is the read surface the connect flow and the partner list
page use, so a non-admin sees their assigned partners without a 403.
"""
return {"partners": visible_partner_cards()}
@router.get("/connections")
async def list_connections():View on GitHub (pinned to 3e82f13042)
Solutions
- Verify the kind via GET listing of backend kinds before calling sync
- Ensure you are syncing a local CLI backend, not the partner backend
- Register/fix the backend kind in deeptutor.services.subagent so get_backend(kind) returns a local CLI backend
Example fix
// before GET /api/v1/subagents/sync/claude_codex_typo // after GET /api/v1/subagents/sync/claude-code // exact kind from list_backend_kinds()
Defensive patterns
Strategy: validation
Validate before calling
const kinds = await (await fetch('/api/v1/subagents/backends')).json();
if (!kinds.includes(kind) ) throw new Error('invalid kind');
if (kind === 'partner') throw new Error('partners cannot sync models'); Type guard
const isSyncableKind = (k: string, kinds: string[]) => kinds.includes(k) && k !== 'partner';
Try / catch
try { await syncBackend(kind); } catch (e) { if (e.status === 400) refreshKinds(); else throw e; } Prevention
- Populate kind dropdowns from the backends list endpoint
- Disable sync UI for partner-kind connections
When it happens
Trigger: GET/POST on the sync_backend route with a kind string that is not in the subagent backend registry, or a kind whose backend object lacks local_cli=True (e.g. the partner backend).
Common situations: Frontend sends a stale or misspelled kind after renaming/removing a backend; calling sync on a partner-kind agent; backend registry not registering a newly added CLI backend.
Related errors
- Unknown agent kind: {agent_kind!r}
- Both name and agent_kind are required.
- A partner_id is required to connect a partner.
- No partner named {partner_id!r}.
- {exc}
AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27).
Data as JSON: /api/errors/27271f7f6b91255c.
Report an issue: GitHub.