bytedance/deer-flow · error · HTTPException
Scheduled task service not available
Error message
Scheduled task service not available
What it means
HTTP 503 from get_scheduled_task_service() when app.state.scheduled_task_service is None. The service layer (trigger evaluation, dispatch into non-interactive runs) sits on top of the scheduled-task repos; missing means the whole scheduler subsystem is not running.
Source
Thrown at backend/app/gateway/deps.py:661
def get_scheduled_task_repo(request: Request):
val = getattr(request.app.state, "scheduled_task_repo", None)
if val is None:
raise HTTPException(status_code=503, detail="Scheduled task repo not available")
return val
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:View on GitHub (pinned to 1dd6ba1acb)
Solutions
- Turn on scheduler.enabled in config.yaml and restart the Gateway
- Read the lifespan logs for the service construction failure and resolve it (typically the scheduled_task_repo dependency)
- Retry the request after a clean restart; the service is restart-required, hot config edits alone will not attach it
Defensive patterns
Strategy: fallback
Validate before calling
null
Type guard
null
Try / catch
try:
await api.toggle_scheduled_task(task_id, enabled=True)
except HTTP503 as e:
if 'Scheduled task service' in e.detail:
notify_user('Scheduler is disabled on this server')
return
raise Prevention
- Keep scheduler.enabled consistent across all Gateway replicas
- Verify scheduler health in smoke tests after config changes
- Remember: service singletons never hot-attach — always restart after config edits
When it happens
Trigger: Invoking any route that Depends() on get_scheduled_task_service (task enable/disable, trigger preview, manual fire) when the scheduler service was not constructed during lifespan.
Common situations: scheduler.enabled false in config.yaml; scheduler service constructor failed (repo/clock dependency unavailable); hitting a route on a Gateway restarted with an old config snapshot.
Related errors
- Scheduled task repo not available
- scheduler.multi_instance=true requires database.backend='pos
- scheduler.multi_instance=true requires run_events.backend='d
- scheduler.multi_instance=true requires run_ownership.heartbe
- GATEWAY_WORKERS={workers} cannot run with scheduler.enabled=
AI-assisted analysis of bytedance/deer-flow@1dd6ba1acb (2026-08-14).
Data as JSON: /api/errors/ffeeea5e58d1c22d.
Report an issue: GitHub.