Hmbown/CodeWhale · error
Codewhale responses request should succeed
Error message
Codewhale responses request should succeed
What it means
This `expect` panics when `client.create_message(...)` returns `Err` for a Responses-wire-format request, aborting with 'Codewhale responses request should succeed' at crates/tui/src/client.rs:7911. The client is expected to stream against the mock server and aggregate usage from the terminal `response.completed` event; any transport, HTTP, or stream-parse failure surfaces here.
Solutions
- Confirm the mock route matches the Responses endpoint (`{base}/responses`), not the chat default
- Log the returned error to see whether it is HTTP status or stream parsing
- Ensure the mock SSE body ends with a `response.completed` event carrying usage
- Re-enable retry or fix the fixture stream if the failure is transient
Example fix
// before
let response = client.create_message(minimal_zen_request("openai/gpt-5.6")).await
.expect("Codewhale responses request should succeed");
// after
let response = client.create_message(minimal_zen_request("openai/gpt-5.6")).await
.unwrap_or_else(|e| panic!("Codewhale responses request should succeed: {e:?}")); Defensive patterns
Strategy: try-catch
Validate before calling
assert_eq!(client.wire_format, WireFormat::Responses); assert!(!client.retry.enabled); // deterministic failure surfacing
Try / catch
let response = client.create_message(req).await
.unwrap_or_else(|e| panic!("Codewhale responses request should succeed: {e:?}")); Prevention
- Register the mock on the /responses path, not the chat default
- Ensure fixture SSE streams include a terminal response.completed event with usage
- Keep retry disabled only when the mock is deterministic
When it happens
Trigger: Calling `create_message` with `wire_format == WireFormat::Responses` and `retry.enabled = false` when the mock returns a non-2xx status, the SSE stream is malformed, or `response.completed` never arrives so usage cannot be built.
Common situations: Mock route registered for `/chat/completions` instead of `/responses`; the fixture SSE events missing the terminal `response.completed` frame; retries disabled so a transient mock hiccup fails immediately.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
- Zen Responses request should start
- Antigravity cloud-code is stream-only; blocking…
- Codewhale chat request should succeed
- Codewhale messages request should succeed
- ${compactRuntimeError(response.status, body)}
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/fbb993a902919f65.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/client.rs:7911
"codewhale",
&fingerprint,
now_unix(),
)
.expect("fixture catalog parses");
crate::provider_catalog_live::record_success(ProviderCatalogDelta {
provider: "codewhale".to_string(),
base_url_fingerprint: fingerprint,
fetched_at: now_unix(),
offerings,
});
let mut client = codewhale_client(&server, "openai/gpt-5.6");
assert_eq!(client.wire_format, WireFormat::Responses);
client.retry.enabled = false;
let response = client
.create_message(minimal_zen_request("openai/gpt-5.6"))
.await
.expect("Codewhale responses request should succeed");
// Responses usage arrives on the terminal `response.completed` event —
// the dialect's equivalent of chat's `stream_options.include_usage`.
assert_eq!(response.usage.input_tokens, 3);
assert_eq!(response.usage.output_tokens, 1);
let requests = server.received_requests().await.expect("recorded request");
assert_eq!(requests.len(), 1);
assert_codewhale_bearer(&requests[0]);
let body: Value = serde_json::from_slice(&requests[0].body).expect("responses JSON body");
assert_eq!(
body.get("model").and_then(Value::as_str),
Some("openai/gpt-5.6")
);
assert!(body.get("input").is_some(), "Responses body: {body}");
assert!(body.get("messages").is_none(), "Responses body: {body}");
crate::provider_catalog_live::reset_cache_for_test();
crate::provider_lake::clear_live_snapshot();View on GitHub (pinned to 73e0f67d83)