{"record":{"id":"7adb3d9741f158ee","repo":"can1357/oh-my-pi","slug":"not-initialized","errorCode":null,"errorMessage":"not initialized","messagePattern":"not initialized","errorType":"http","errorClass":"HTTPException","httpStatus":503,"severity":"warning","filePath":"python/robomp/src/server.py","lineNumber":324,"sourceCode":"        finally:\n            await index_sync.stop()\n            await autoclose.stop()\n            await pool.stop(\n                drain_timeout=cfg.shutdown_drain_timeout_seconds,\n                kill_timeout=cfg.shutdown_kill_timeout_seconds,\n            )\n\n    app = FastAPI(title=\"robomp\", version=\"0.1.0\", lifespan=lifespan)\n\n    @app.get(\"/healthz\")\n    async def healthz() -> dict[str, str]:\n        return {\"status\": \"ok\"}\n\n    @app.get(\"/readyz\")\n    async def readyz(request: Request) -> dict[str, str]:\n        pool = request.app.state.bag.get(\"pool\")\n        if pool is None:\n            raise HTTPException(503, \"not initialized\")\n        return {\"status\": \"ready\"}\n\n    @app.post(\"/webhook/github\")\n    async def webhook(\n        request: Request,\n        x_github_event: str = Header(..., alias=\"X-GitHub-Event\"),\n        x_github_delivery: str = Header(..., alias=\"X-GitHub-Delivery\"),\n        x_hub_signature_256: str | None = Header(None, alias=\"X-Hub-Signature-256\"),\n    ) -> JSONResponse:\n        bag = request.app.state.bag\n        cfg: Settings = bag[\"settings\"]\n        body = await request.body()\n        if not github_events.verify_signature(\n            cfg.github_webhook_secret.get_secret_value(),\n            body,\n            x_hub_signature_256,\n        ):\n            raise HTTPException(status.HTTP_401_UNAUTHORIZED, \"invalid signature\")","sourceCodeStart":306,"sourceCodeEnd":342,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/python/robomp/src/server.py#L306-L342","documentation":"The /readyz readiness probe returns HTTP 503 'not initialized' when the app-state bag has no 'pool' entry — i.e. the SandboxManager workspace pool (and the rest of the orchestrator wiring) has not been attached to the FastAPI app yet, so the instance cannot serve work.","triggerScenarios":"GET /readyz during startup before _build_orchestrator finishes populating app.state.bag, or if orchestrator build fails/crashes leaving the pool unset.","commonSituations":"Kubernetes/compose health checks probing during container boot (transient, expected); orchestrator startup crash (git/config error) leaving the app half-initialized; calling /readyz on a manually-constructed create_app() without injecting the pool.","solutions":["If transient during startup, retry — readiness flips to 200 once the pool is registered.","Check container logs for a startup exception (e.g. GitCommandError, SystemExit from config) and fix that root cause.","Verify required env/paths (/data workspaces, sqlite) are writable so initialization completes.","Only gate deployment readiness on /healthz vs /readyz correctly: 503 here means wait or fix startup."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"import httpx\nr = httpx.get('http://host:8080/readyz')\nif r.status_code == 503 and 'not initialized' in r.text:\n    ...  # still booting: wait and re-probe; if persistent, check startup logs","preventionTips":["Configure orchestrator health checks with a startup grace period","Watch container logs during boot for initialization exceptions","Treat persistent 503 after startup as a crash signal, not a probe flake"],"tags":["http","readiness","startup","fastapi"],"backgroundTag":"service-not-ready","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}