Hmbown/CodeWhale · error · anyhow::Error

turn failed

Error message

turn failed

What it means

Sentinel default used when a turn ends with TurnTerminalStatus::Failed but the terminal event carried no error text; the stream result finished with an empty error field. It names the failure without adding information the runtime did not provide, and signals the turn was rejected by the runtime rather than crashing locally.

Source

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

        let (last_seq, status, error) = stream_result?;
        self.last_seq_by_thread
            .insert(thread_id.to_string(), last_seq);

        match status {
            TurnTerminalStatus::Completed => Ok(json!({
                "thread_id": thread_id,
                "status": "accepted",
                "thread": Value::Null,
                "threads": [],
                "model": Value::Null,
                "model_provider": Value::Null,
                "cwd": Value::Null,
                "approval_policy": Value::Null,
                "sandbox": Value::Null,
                "events": [],
                "data": { "turn_id": turn_id },
            })),
            TurnTerminalStatus::Failed => Err(anyhow!(
                "{}",
                error.unwrap_or_else(|| "turn failed".to_string())
            )),
            TurnTerminalStatus::Interrupted => Err(anyhow!(
                "{}",
                error.unwrap_or_else(|| "turn interrupted".to_string())
            )),
            TurnTerminalStatus::Canceled => Err(anyhow!(
                "{}",
                error.unwrap_or_else(|| "turn canceled".to_string())
            )),
        }
    }

    async fn stream_turn_events<W: AsyncWrite + Unpin>(
        &self,
        thread_id: &str,
        turn_id: &str,

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Retry the turn; transient runtime failures often succeed on a second attempt
  2. Inspect runtime bridge and session logs for the real cause of the failed turn
  3. Check that the prompt, tools, and config are valid inputs for the runtime
  4. Restart or update the runtime bridge if failures recur without error detail
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at crates/app-server/src/lib.rs:1244 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/0e3e412d6a390aea. Report an issue: GitHub.