Hmbown/CodeWhale · error
runtime API bridge exited before becoming ready
Error message
runtime API bridge exited before becoming ready (status {status}) What it means
Thrown by `wait_until_ready` while polling the spawned runtime API bridge child process. Before each readiness probe the method calls `child.try_wait()`; if the child has already terminated with `status`, it is impossible for it to become ready, so the error is returned immediately rather than waiting out the 15-second deadline. It reports the OS exit status of the premature exit.
Solutions
- Inspect the bridge process's stderr/stdout logs to find why it exited before becoming ready (status shows the exit code).
- Run the bridge binary manually with the same arguments to reproduce the startup failure.
- Verify the bridge executable path, permissions, and required environment (config, ports) are correct.
- Retry once transient resource issues (OOM, port conflicts) are ruled out.
Defensive patterns
Strategy: retry
Validate before calling
// Verify the bridge binary exists and is executable before spawning assert!(std::path::Path::new(&bridge_path).exists(), "bridge binary missing");
Try / catch
match wait_until_ready(&mut bridge).await {
Err(e) if e.to_string().contains("exited before becoming ready") => {
// capture child stderr logs, then retry with a bounded backoff
}
other => other?,
} Prevention
- Always pipe bridge stderr to a log file so premature exits are diagnosable
- Smoke-test the bridge binary at startup (version/health subcommand)
- Check port availability and required env before spawning
- Use bounded retries on startup
When it happens
Trigger: Starting the runtime API bridge and awaiting readiness when the child binary crashes, exits with a nonzero code, or terminates during startup within the 15-second readiness window.
Common situations: A broken or missing bridge binary, bad port/arguments, crash at startup due to config errors, OOM kill, or a dependency failing on the child side; environment issues where the runtime cannot initialize.
Related errors
- Cannot resolve current binary path
- Cloud agent harness exited with code
- exited
- Command failed with exit code
- Command timed out after
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/aca3d6d304738c95.
Report an issue: GitHub.
Appendix: source
Thrown at crates/app-server/src/lib.rs:1584
.arg(port.to_string())
.env("CODEWHALE_RUNTIME_TOKEN", auth_token)
.env("DEEPSEEK_RUNTIME_TOKEN", auth_token)
.stdin(Stdio::null())
.stdout(Stdio::null())
.stderr(Stdio::null());
if let Some(config_path) = config_path {
command.arg("--config").arg(config_path);
}
Ok(command)
}
async fn wait_until_ready(&mut self) -> Result<()> {
let deadline = Instant::now() + Duration::from_secs(15);
loop {
if let Some(child) = self.child.as_mut()
&& let Some(status) = child.try_wait()?
{
return Err(anyhow!(
"runtime API bridge exited before becoming ready (status {status})"
));
}
match self
.client
.get(format!("{}/health", self.base_url))
.send()
.await
{
Ok(response) if response.status().is_success() => return Ok(()),
_ if Instant::now() >= deadline => {
bail!(
"timed out waiting for runtime API bridge at {}/health",
self.base_url
)
}
_ => tokio::time::sleep(Duration::from_millis(50)).await,View on GitHub (pinned to 73e0f67d83)