Hmbown/CodeWhale · error · anyhow::Error

exec turn failed: {error}

Error message

exec turn failed: {error}

What it means

Terminal failure path for `codewhale exec`: the completed turn's summary carries a non-empty error. The exit code was computed from error_category — this bail! is the historical exit-1 path kept for genuine task failures, so supervisors see exit 1 rather than a retryable-infrastructure code.

Source

Thrown at crates/tui/src/lib.rs:12294

    if json_output {
        println!("{}", serde_json::to_string_pretty(&summary)?);
    }

    if let Some(error) = summary.error.as_ref()
        && !error.trim().is_empty()
    {
        // Distinguish retryable infrastructure failures (provider/transport,
        // after all in-session retries are exhausted) from genuine task
        // failures so supervisors and bench harnesses can tell them apart at
        // the process level without parsing the stream. Genuine failures
        // keep the historical `bail!` → exit 1 path.
        let exit_code = exec_failure_exit_code(summary.error_category.as_deref());
        if exit_code != 1 {
            eprintln!("Error: exec turn failed: {error}");
            let _ = io::stdout().flush();
            std::process::exit(exit_code);
        }
        bail!("exec turn failed: {error}");
    }

    if matches!(
        summary.status.as_deref(),
        Some("failed" | "canceled" | "interrupted")
    ) {
        let status = summary.status.as_deref().unwrap_or("unknown");
        bail!("exec turn ended with status {status}");
    }

    Ok(())
}

#[cfg(test)]
mod serve_bind_host_tests {
    use super::*;

    #[test]

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Read the embedded {error} text from the turn summary
  2. Fix the task-level cause (bad prompt, tool failure, etc.)
  3. Re-run the exec command
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at crates/tui/src/lib.rs:12294 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/43b417070d73371d. Report an issue: GitHub.