can1357/oh-my-pi · warning · HTTPException

not initialized

Error message

not initialized

What it means

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.

Source

Thrown at python/robomp/src/server.py:324

        finally:
            await index_sync.stop()
            await autoclose.stop()
            await pool.stop(
                drain_timeout=cfg.shutdown_drain_timeout_seconds,
                kill_timeout=cfg.shutdown_kill_timeout_seconds,
            )

    app = FastAPI(title="robomp", version="0.1.0", lifespan=lifespan)

    @app.get("/healthz")
    async def healthz() -> dict[str, str]:
        return {"status": "ok"}

    @app.get("/readyz")
    async def readyz(request: Request) -> dict[str, str]:
        pool = request.app.state.bag.get("pool")
        if pool is None:
            raise HTTPException(503, "not initialized")
        return {"status": "ready"}

    @app.post("/webhook/github")
    async def webhook(
        request: Request,
        x_github_event: str = Header(..., alias="X-GitHub-Event"),
        x_github_delivery: str = Header(..., alias="X-GitHub-Delivery"),
        x_hub_signature_256: str | None = Header(None, alias="X-Hub-Signature-256"),
    ) -> JSONResponse:
        bag = request.app.state.bag
        cfg: Settings = bag["settings"]
        body = await request.body()
        if not github_events.verify_signature(
            cfg.github_webhook_secret.get_secret_value(),
            body,
            x_hub_signature_256,
        ):
            raise HTTPException(status.HTTP_401_UNAUTHORIZED, "invalid signature")

View on GitHub (pinned to 9690622007)

Solutions

  1. If transient during startup, retry — readiness flips to 200 once the pool is registered.
  2. Check container logs for a startup exception (e.g. GitCommandError, SystemExit from config) and fix that root cause.
  3. Verify required env/paths (/data workspaces, sqlite) are writable so initialization completes.
  4. Only gate deployment readiness on /healthz vs /readyz correctly: 503 here means wait or fix startup.
Defensive patterns

Strategy: fallback

Try / catch

import httpx
r = httpx.get('http://host:8080/readyz')
if r.status_code == 503 and 'not initialized' in r.text:
    ...  # still booting: wait and re-probe; if persistent, check startup logs

Prevention

When it happens

Trigger: GET /readyz during startup before _build_orchestrator finishes populating app.state.bag, or if orchestrator build fails/crashes leaving the pool unset.

Common situations: 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.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/7adb3d9741f158ee. Report an issue: GitHub.