bytedance/deer-flow · error · HTTPException

Scheduled task run repo not available

Error message

Scheduled task run repo not available

What it means

HTTP 503 from get_scheduled_task_run_repo() when app.state.scheduled_task_run_repo is None. This repo stores execution history of scheduled task runs; it is created together with the scheduled-task subsystem during Gateway lifespan.

Source

Thrown at backend/app/gateway/deps.py:654

def get_thread_store(request: Request) -> ThreadMetaStore:
    """Return the thread metadata store (SQL or memory-backed)."""
    val = getattr(request.app.state, "thread_store", None)
    if val is None:
        raise HTTPException(status_code=503, detail="Thread metadata store not available")
    return val


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):

View on GitHub (pinned to 1dd6ba1acb)

Solutions

  1. Enable the scheduler in config.yaml (scheduler.enabled: true) and restart the Gateway
  2. Inspect startup logs for a scheduled-task repo init exception; fix the DB/persistence issue it names
  3. Confirm the scheduled_task_repo sibling is also present — run repo attaches in the same lifecycle; if one is missing both usually are
Defensive patterns

Strategy: fallback

Validate before calling

# if scheduler disabled, skip run-history calls entirely
if not config.scheduler_enabled:
    return []  # don't call the run-history endpoint

Type guard

null

Try / catch

try:
    runs = await api.list_scheduled_task_runs(task_id)
except HTTP503 as e:
    if 'Scheduled task run repo' in e.detail:
        runs = []  # history unavailable — render empty state
    else:
        raise

Prevention

When it happens

Trigger: Calling endpoints that list or inspect scheduled-task run history when the scheduler subsystem never initialised (scheduler disabled in config, or its lifespan bootstrap failed).

Common situations: Viewing the run-history tab of /workspace/scheduled-tasks against a Gateway with scheduler.enabled false; scheduler init aborted at startup because its DB tables could not be created.

Related errors


AI-assisted analysis of bytedance/deer-flow@1dd6ba1acb (2026-08-14). Data as JSON: /api/errors/f428776f86a510f2. Report an issue: GitHub.