{"record":{"id":"f428776f86a510f2","repo":"bytedance/deer-flow","slug":"scheduled-task-run-repo-not-available","errorCode":null,"errorMessage":"Scheduled task run repo not available","messagePattern":"Scheduled task run repo not available","errorType":"http","errorClass":"HTTPException","httpStatus":503,"severity":"error","filePath":"backend/app/gateway/deps.py","lineNumber":654,"sourceCode":"def get_thread_store(request: Request) -> ThreadMetaStore:\n    \"\"\"Return the thread metadata store (SQL or memory-backed).\"\"\"\n    val = getattr(request.app.state, \"thread_store\", None)\n    if val is None:\n        raise HTTPException(status_code=503, detail=\"Thread metadata store not available\")\n    return val\n\n\ndef get_scheduled_task_repo(request: Request):\n    val = getattr(request.app.state, \"scheduled_task_repo\", None)\n    if val is None:\n        raise HTTPException(status_code=503, detail=\"Scheduled task repo not available\")\n    return val\n\n\ndef get_scheduled_task_run_repo(request: Request):\n    val = getattr(request.app.state, \"scheduled_task_run_repo\", None)\n    if val is None:\n        raise HTTPException(status_code=503, detail=\"Scheduled task run repo not available\")\n    return val\n\n\ndef get_scheduled_task_service(request: Request):\n    val = getattr(request.app.state, \"scheduled_task_service\", None)\n    if val is None:\n        raise HTTPException(status_code=503, detail=\"Scheduled task service not available\")\n    return val\n\n\ndef get_mcp_task_repo(request: Request):\n    val = getattr(request.app.state, \"mcp_task_repo\", None)\n    if val is None:\n        raise HTTPException(status_code=503, detail=\"MCP task repo not available\")\n    return val\n\n\ndef get_mcp_task_service(request: Request):","sourceCodeStart":636,"sourceCodeEnd":672,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/backend/app/gateway/deps.py#L636-L672","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Enable the scheduler in config.yaml (scheduler.enabled: true) and restart the Gateway","Inspect startup logs for a scheduled-task repo init exception; fix the DB/persistence issue it names","Confirm the scheduled_task_repo sibling is also present — run repo attaches in the same lifecycle; if one is missing both usually are"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"# if scheduler disabled, skip run-history calls entirely\nif not config.scheduler_enabled:\n    return []  # don't call the run-history endpoint","typeGuard":"null","tryCatchPattern":"try:\n    runs = await api.list_scheduled_task_runs(task_id)\nexcept HTTP503 as e:\n    if 'Scheduled task run repo' in e.detail:\n        runs = []  # history unavailable — render empty state\n    else:\n        raise","preventionTips":["Treat run-history as optional data in the UI","Gate history requests on the same scheduler feature flag as task CRUD","Monitor Gateway startup for scheduler init failures before they become user-facing 503s"],"tags":["http-503","scheduler","run-history","persistence","gateway"],"backgroundTag":null,"analyzedSha":"1dd6ba1acb03700589994b0366c5d1c7d05e2eff","analyzedAt":"2026-08-14T21:20:34.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}