{"record":{"id":"23e266d6b45bc388","repo":"Hmbown/CodeWhale","slug":"timed-out-waiting-for-runtime-api-bridge-at-hea","errorCode":null,"errorMessage":"timed out waiting for runtime API bridge at {}/health","messagePattern":"timed out waiting for runtime API bridge at (.+?)/health","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/app-server/src/lib.rs","lineNumber":1597,"sourceCode":"        let deadline = Instant::now() + Duration::from_secs(15);\n        loop {\n            if let Some(child) = self.child.as_mut()\n                && let Some(status) = child.try_wait()?\n            {\n                return Err(anyhow!(\n                    \"runtime API bridge exited before becoming ready (status {status})\"\n                ));\n            }\n\n            match self\n                .client\n                .get(format!(\"{}/health\", self.base_url))\n                .send()\n                .await\n            {\n                Ok(response) if response.status().is_success() => return Ok(()),\n                _ if Instant::now() >= deadline => {\n                    bail!(\n                        \"timed out waiting for runtime API bridge at {}/health\",\n                        self.base_url\n                    )\n                }\n                _ => tokio::time::sleep(Duration::from_millis(50)).await,\n            }\n        }\n    }\n\n    fn authed(&self, builder: reqwest::RequestBuilder) -> reqwest::RequestBuilder {\n        match self.auth_token.as_deref() {\n            Some(token) => builder.bearer_auth(token),\n            None => builder,\n        }\n    }\n\n    async fn request_json(&self, builder: reqwest::RequestBuilder) -> Result<Value> {\n        let response = builder.send().await?;","sourceCodeStart":1579,"sourceCodeEnd":1615,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/app-server/src/lib.rs#L1579-L1615","documentation":"The app-server polls the Runtime API bridge's `/health` endpoint every 50 ms until a deadline; if the endpoint never returns a successful response in time, startup fails with this timeout. It means the runtime process did not come up, is listening on a different URL, or is wedged.","triggerScenarios":"`wait_for_health`-style polling loop sees non-success HTTP statuses or connection errors from `GET {base_url}/health` until `Instant::now() >= deadline`.","commonSituations":"Runtime binary fails to start (missing binary, port conflict), slow cold start exceeding the deadline, or base_url misconfigured to the wrong port.","solutions":["Check the runtime process is actually running and listening on base_url (curl the /health endpoint manually).","Check for port conflicts (`address already in use`) or a wrong port in the runtime configuration.","Inspect runtime stderr/logs for a startup crash.","Increase the health-wait deadline if the runtime legitimately takes long to boot."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// probe before relying on the bridge\nlet ok = reqwest::get(format!(\"{base}/health\")).await.ok()\n    .map(|r| r.status().is_success()).unwrap_or(false);\nif !ok { eprintln!(\"runtime bridge not healthy yet\"); }","typeGuard":null,"tryCatchPattern":"// wrap launch with retry/backoff on timeout\nmatch start_app_server().await {\n    Err(e) if e.to_string().contains(\"timed out waiting for runtime API bridge\") => {\n        // inspect runtime logs, then retry once with a longer deadline\n    }\n    Err(e) => return Err(e),\n    Ok(v) => Ok(v),\n}","preventionTips":["Verify the runtime binary path and port in config before launch.","Check for port conflicts with `ss -ltnp` / `lsof -i :<port>`.","Capture runtime stderr so startup crashes are visible instead of appearing as health timeouts."],"tags":["network","timeout","health-check","runtime"],"backgroundTag":"request-timeout","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}