{"record":{"id":"43b417070d73371d","repo":"Hmbown/CodeWhale","slug":"exec-turn-failed-error","errorCode":null,"errorMessage":"exec turn failed: {error}","messagePattern":"exec turn failed: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":12294,"sourceCode":"    if json_output {\n        println!(\"{}\", serde_json::to_string_pretty(&summary)?);\n    }\n\n    if let Some(error) = summary.error.as_ref()\n        && !error.trim().is_empty()\n    {\n        // Distinguish retryable infrastructure failures (provider/transport,\n        // after all in-session retries are exhausted) from genuine task\n        // failures so supervisors and bench harnesses can tell them apart at\n        // the process level without parsing the stream. Genuine failures\n        // keep the historical `bail!` → exit 1 path.\n        let exit_code = exec_failure_exit_code(summary.error_category.as_deref());\n        if exit_code != 1 {\n            eprintln!(\"Error: exec turn failed: {error}\");\n            let _ = io::stdout().flush();\n            std::process::exit(exit_code);\n        }\n        bail!(\"exec turn failed: {error}\");\n    }\n\n    if matches!(\n        summary.status.as_deref(),\n        Some(\"failed\" | \"canceled\" | \"interrupted\")\n    ) {\n        let status = summary.status.as_deref().unwrap_or(\"unknown\");\n        bail!(\"exec turn ended with status {status}\");\n    }\n\n    Ok(())\n}\n\n#[cfg(test)]\nmod serve_bind_host_tests {\n    use super::*;\n\n    #[test]","sourceCodeStart":12276,"sourceCodeEnd":12312,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/lib.rs#L12276-L12312","documentation":"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.","triggerScenarios":"Thrown at crates/tui/src/lib.rs:12294 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the embedded {error} text from the turn summary","Fix the task-level cause (bad prompt, tool failure, etc.)","Re-run the exec command"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}