Hmbown/CodeWhale · error · anyhow::Error

runtime API thread response missing id

Error message

runtime API thread response missing id

What it means

Contract guard in extract_runtime_thread_id: a JSON record received from the runtime API lacks a string id field, so it cannot be used as a thread reference. This is a malformed-response check on untrusted runtime output; any record without a usable id is rejected rather than defaulted.

Source

Thrown at crates/app-server/src/lib.rs:1385

    fn drop(&mut self) {
        self.shutdown_child();
    }
}

fn reserve_runtime_port() -> Result<u16> {
    let listener = std::net::TcpListener::bind("127.0.0.1:0")?;
    Ok(listener.local_addr()?.port())
}

fn install_rustls_crypto_provider() {
    let _ = rustls::crypto::ring::default_provider().install_default();
}

fn extract_runtime_thread_id(record: &Value) -> Result<&str> {
    record
        .get("id")
        .and_then(Value::as_str)
        .ok_or_else(|| anyhow!("runtime API thread response missing id"))
}

fn turn_terminal_status(payload: &Value) -> TurnTerminalStatus {
    match payload
        .pointer("/turn/status")
        .and_then(Value::as_str)
        .unwrap_or("completed")
        .to_ascii_lowercase()
        .as_str()
    {
        "failed" => TurnTerminalStatus::Failed,
        "interrupted" => TurnTerminalStatus::Interrupted,
        "canceled" | "cancelled" => TurnTerminalStatus::Canceled,
        _ => TurnTerminalStatus::Completed,
    }
}

async fn emit_stdio_event<W: AsyncWrite + Unpin>(writer: &mut W, event: Value) -> Result<()> {

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Retry the request; truncated responses can transiently omit fields
  2. Verify the runtime bridge version emits id on its thread records
  3. Inspect the raw runtime response in logs to confirm its shape
  4. Restart or upgrade the runtime bridge if records consistently lack ids
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/app-server/src/lib.rs:1385 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/b6f12e68043bf638. Report an issue: GitHub.