{"record":{"id":"ffeeea5e58d1c22d","repo":"bytedance/deer-flow","slug":"scheduled-task-service-not-available","errorCode":null,"errorMessage":"Scheduled task service not available","messagePattern":"Scheduled task service not available","errorType":"http","errorClass":"HTTPException","httpStatus":503,"severity":"error","filePath":"backend/app/gateway/deps.py","lineNumber":661,"sourceCode":"\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):\n    val = getattr(request.app.state, \"mcp_task_service\", None)\n    if val is None:\n        raise HTTPException(status_code=503, detail=\"MCP task service not available\")\n    return val\n\n\ndef get_run_context(request: Request) -> RunContext:","sourceCodeStart":643,"sourceCodeEnd":679,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/backend/app/gateway/deps.py#L643-L679","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"null","typeGuard":"null","tryCatchPattern":"try:\n    await api.toggle_scheduled_task(task_id, enabled=True)\nexcept HTTP503 as e:\n    if 'Scheduled task service' in e.detail:\n        notify_user('Scheduler is disabled on this server')\n        return\n    raise","preventionTips":["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"],"tags":["http-503","scheduler","service","config","gateway"],"backgroundTag":null,"analyzedSha":"1dd6ba1acb03700589994b0366c5d1c7d05e2eff","analyzedAt":"2026-08-14T21:20:34.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}