{"record":{"id":"a777c365a5086795","repo":"Hmbown/CodeWhale","slug":"zen-responses-request-should-start","errorCode":null,"errorMessage":"Zen Responses request should start","messagePattern":"Zen Responses request should start","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/client.rs","lineNumber":8132,"sourceCode":"    async fn opencode_zen_responses_request_uses_responses_route_without_oauth_headers() {\n        let server = MockServer::start().await;\n        Mock::given(method(\"POST\"))\n            .and(path(\"/v1/responses\"))\n            .respond_with(\n                ResponseTemplate::new(200)\n                    .insert_header(\"Content-Type\", \"text/event-stream\")\n                    .set_body_string(\"data: [DONE]\\n\\n\"),\n            )\n            .expect(1)\n            .mount(&server)\n            .await;\n\n        let client = opencode_zen_client(&server, \"gpt-5.5\");\n        assert_eq!(client.wire_format, WireFormat::Responses);\n        let mut stream = client\n            .create_message_stream(minimal_zen_request(\"gpt-5.5\"))\n            .await\n            .expect(\"Zen Responses request should start\");\n        while let Some(event) = stream.next().await {\n            event.expect(\"Zen Responses stream event\");\n        }\n\n        let requests = server.received_requests().await.expect(\"recorded request\");\n        assert_eq!(requests.len(), 1);\n        assert_zen_bearer_without_codex_headers(&requests[0]);\n        let body: Value = serde_json::from_slice(&requests[0].body).expect(\"Responses JSON body\");\n        assert_eq!(body.get(\"model\").and_then(Value::as_str), Some(\"gpt-5.5\"));\n        assert!(body.get(\"input\").is_some(), \"Responses body: {body}\");\n        assert!(body.get(\"messages\").is_none(), \"Responses body: {body}\");\n    }\n\n    #[tokio::test]\n    async fn opencode_zen_messages_request_shape_uses_api_key_anthropic_route() {\n        let server = MockServer::start().await;\n        Mock::given(method(\"POST\"))\n            .and(path(\"/v1/messages\"))","sourceCodeStart":8114,"sourceCodeEnd":8150,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/client.rs#L8114-L8150","documentation":"Test-side `.expect(\"Zen Responses request should start\")` panic. `create_message_stream` returned `Err`, meaning the client could not establish the streaming request against the mocked `/v1/responses` endpoint. Because the wire format is `WireFormat::Responses`, this is the SSE-streaming path failing before any events are produced.","triggerScenarios":"Running `opencode_zen_responses_request_uses_responses_route_without_oauth_headers` when the mock route is not mounted at the path the client resolves (e.g. `/v1/responses`), the client picks the wrong wire format/route, connection setup fails, or the model route resolution errors (model not bound to Responses protocol).","commonSituations":"Changing base URL or route constants so the mock no longer matches; renaming the helper `opencode_zen_client`'s configured model so route resolution no longer maps to Responses; TLS/port or tokio runtime issues in the test harness.","solutions":["Check that `Mock::given(method(\"POST\")).and(path(\"/v1/responses\"))` still matches the URL the client builds from its base_url.","Verify `client.wire_format == WireFormat::Responses` before the call (asserted just above) and that route resolution maps gpt-5.5 to the Responses endpoint.","Print the error (`{:?}`) from `create_message_stream` to see whether it is connection, routing, or auth related.","Confirm the mock server is started and mounted before `create_message_stream` is awaited."],"exampleFix":"// before\nlet mut stream = client\n    .create_message_stream(minimal_zen_request(\"gpt-5.5\"))\n    .await\n    .expect(\"Zen Responses request should start\");\n// after (debugging)\nlet mut stream = client\n    .create_message_stream(minimal_zen_request(\"gpt-5.5\"))\n    .await\n    .unwrap_or_else(|e| panic!(\"Zen Responses request should start: {e:?}\"));","handlingStrategy":"try-catch","validationCode":"// Rust (preconditions in test)\nassert_eq!(client.wire_format, WireFormat::Responses, \"model must resolve to Responses wire\");\nassert!(Mock::given(method(\"POST\")).and(path(\"/v1/responses\")).matches(), \"route must be mounted\");","typeGuard":null,"tryCatchPattern":"match client.create_message_stream(req).await {\n    Ok(stream) => { /* consume */ }\n    Err(e) => panic!(\"stream should start: {e:?}\"),\n}","preventionTips":["Keep route constants in one place shared by client and test fixtures.","Assert wire_format before issuing the request.","Print the error chain (`{:#}`) in expect messages when tests fail.","Mount mocks before any client call."],"tags":["test-assertion","streaming","http","rust"],"backgroundTag":"http-request-failed","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T11:17:16.035Z"}