{"record":{"id":"fe778672cde4d39c","repo":"Hmbown/CodeWhale","slug":"go-client-resolves-the-model-protocol","errorCode":null,"errorMessage":"Go client resolves the model protocol","messagePattern":"Go client resolves the model protocol","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/client.rs","lineNumber":8046,"sourceCode":"                .and(path(endpoint))\n                .respond_with(response)\n                .expect(1)\n                .mount(&server)\n                .await;\n            let mut client = CodewhaleClient::new(&Config {\n                provider: Some(\"opencode-go\".into()),\n                providers: Some(ProvidersConfig {\n                    opencode_go: ProviderConfig {\n                        api_key: Some(\"go-test-key\".into()),\n                        base_url: Some(format!(\"{}/zen/go/v1\", server.uri())),\n                        model: Some(format!(\"opencode-go/{model}\")),\n                        ..ProviderConfig::default()\n                    },\n                    ..ProvidersConfig::default()\n                }),\n                ..Config::default()\n            })\n            .expect(\"Go client resolves the model protocol\");\n            client.retry.enabled = false;\n            assert_eq!(client.wire_format, wire);\n            if wire == WireFormat::Responses {\n                let mut stream = client\n                    .create_message_stream(minimal_zen_request(model))\n                    .await\n                    .unwrap();\n                while let Some(event) = stream.next().await {\n                    event.unwrap();\n                }\n                assert!(\n                    client\n                        .prepare_outbound_request(minimal_zen_request(\"minimax-m3\"), false)\n                        .is_err(),\n                    \"a request cannot silently change an existing client's protocol\"\n                );\n            } else {\n                client","sourceCodeStart":8028,"sourceCodeEnd":8064,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/client.rs#L8028-L8064","documentation":"This `expect` panics when `CodewhaleClient::new(&config)` fails to resolve the configured model's protocol/wire format, aborting with 'Go client resolves the model protocol' at crates/tui/src/client.rs:8046. Construction must map the model id onto a wire format (Chat, Responses, AnthropicMessages); an unresolvable route or missing provider config yields `Err`.","triggerScenarios":"Calling `CodewhaleClient::new` inside the wire-format matrix test with a model id that no provider entry or catalog offering claims, or a provider config missing the fields needed to pick a protocol (e.g. no base_url for the namespace).","commonSituations":"Adding a new model row to the test matrix without registering its provider/catalog fixture; catalog cache not reset so a stale live snapshot hides the model; model id typos such as wrong provider prefix.","solutions":["Print the construction error to identify the unresolvable model","Verify each matrix entry's model id exists in the fixture/live catalog with the expected wire format","Reset the catalog cache and seed it via `record_success` before building clients","Complete the `ProviderConfig` for the namespace (base_url, auth) so protocol resolution succeeds"],"exampleFix":"// before\n.expect(\"Go client resolves the model protocol\");\n// after\n.unwrap_or_else(|e| panic!(\"Go client resolves the model protocol: {e:?}\"));","handlingStrategy":"validation","validationCode":"let expected = catalog.offerings.iter().find(|o| o.id == model_id)\n    .expect(\"model present in catalog before client construction\");","typeGuard":null,"tryCatchPattern":"let mut client = CodewhaleClient::new(&config)\n    .unwrap_or_else(|e| panic!(\"Go client resolves the model protocol: {e:?}\"));","preventionTips":["Register every matrix model id in the provider/catalog fixture","Reset the catalog cache and live snapshot per test to avoid stale routes","Include base_url and auth in every ProviderConfig used for protocol resolution"],"tags":["rust","config","wire-format"],"backgroundTag":"invalid-config-value","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}