bytedance/deer-flow · error · HTTPException
MCP task repo not available
Error message
MCP task repo not available
What it means
HTTP 503 from get_mcp_task_repo() when app.state.mcp_task_repo is None. The MCP task repository stores MCP-server task records; it is attached during Gateway lifespan as part of persistence bootstrap.
Source
Thrown at backend/app/gateway/deps.py:668
def get_scheduled_task_run_repo(request: Request):
val = getattr(request.app.state, "scheduled_task_run_repo", None)
if val is None:
raise HTTPException(status_code=503, detail="Scheduled task run repo not available")
return val
def get_scheduled_task_service(request: Request):
val = getattr(request.app.state, "scheduled_task_service", None)
if val is None:
raise HTTPException(status_code=503, detail="Scheduled task service not available")
return val
def get_mcp_task_repo(request: Request):
val = getattr(request.app.state, "mcp_task_repo", None)
if val is None:
raise HTTPException(status_code=503, detail="MCP task repo not available")
return val
def get_mcp_task_service(request: Request):
val = getattr(request.app.state, "mcp_task_service", None)
if val is None:
raise HTTPException(status_code=503, detail="MCP task service not available")
return val
def get_run_context(request: Request) -> RunContext:
"""Build a :class:`RunContext` from ``app.state`` singletons.
Returns a *base* context with infrastructure dependencies. The
``app_config`` field is resolved live so per-run fields (e.g.
``models[*].max_tokens``) follow ``config.yaml`` edits; the
``event_store`` / ``run_events_config`` pair stays frozen to the snapshot
captured in :func:`langgraph_runtime` so callers never see a store boundView on GitHub (pinned to 1dd6ba1acb)
Solutions
- Check Gateway startup logs for the MCP task repo init exception
- Verify the persistence database is reachable and the relevant tables/migrations exist
- Restart the Gateway after fixing persistence so lifespan re-attaches mcp_task_repo
Defensive patterns
Strategy: try-catch
Validate before calling
null
Type guard
null
Try / catch
try:
tasks = await api.list_mcp_tasks()
except HTTP503 as e:
if 'MCP task repo' in e.detail:
tasks = []
else:
raise Prevention
- Verify DB migrations are applied before enabling MCP task features in the UI
- Health-check persistence at startup, not per request
- Pin frontend/backend versions together to avoid calling endpoints the backend cannot serve
When it happens
Trigger: Calling MCP task routes (list/create/delete MCP task records) on a Gateway whose lifespan did not attach mcp_task_repo — persistence init failure or running against an app instance without the Gateway lifespan.
Common situations: Database unavailable at startup so the repo never constructed; version mismatch between frontend expecting MCP task endpoints and a backend build without them; routers exercised in tests without full lifespan.
Related errors
- Thread metadata store not available
- MCP task service not available
- {label} not available
- Scheduled task run repo not available
- Configuration not available
AI-assisted analysis of bytedance/deer-flow@1dd6ba1acb (2026-08-14).
Data as JSON: /api/errors/eec9985e87060e82.
Report an issue: GitHub.