Hmbown/CodeWhale · error

Go client resolves the model protocol

Error message

Go client resolves the model protocol

What it means

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`.

Solutions

  1. Print the construction error to identify the unresolvable model
  2. Verify each matrix entry's model id exists in the fixture/live catalog with the expected wire format
  3. Reset the catalog cache and seed it via `record_success` before building clients
  4. Complete the `ProviderConfig` for the namespace (base_url, auth) so protocol resolution succeeds

Example fix

// before
.expect("Go client resolves the model protocol");
// after
.unwrap_or_else(|e| panic!("Go client resolves the model protocol: {e:?}"));
Defensive patterns

Strategy: validation

Validate before calling

let expected = catalog.offerings.iter().find(|o| o.id == model_id)
    .expect("model present in catalog before client construction");

Try / catch

let mut client = CodewhaleClient::new(&config)
    .unwrap_or_else(|e| panic!("Go client resolves the model protocol: {e:?}"));

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/fe778672cde4d39c. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/client.rs:8046

                .and(path(endpoint))
                .respond_with(response)
                .expect(1)
                .mount(&server)
                .await;
            let mut client = CodewhaleClient::new(&Config {
                provider: Some("opencode-go".into()),
                providers: Some(ProvidersConfig {
                    opencode_go: ProviderConfig {
                        api_key: Some("go-test-key".into()),
                        base_url: Some(format!("{}/zen/go/v1", server.uri())),
                        model: Some(format!("opencode-go/{model}")),
                        ..ProviderConfig::default()
                    },
                    ..ProvidersConfig::default()
                }),
                ..Config::default()
            })
            .expect("Go client resolves the model protocol");
            client.retry.enabled = false;
            assert_eq!(client.wire_format, wire);
            if wire == WireFormat::Responses {
                let mut stream = client
                    .create_message_stream(minimal_zen_request(model))
                    .await
                    .unwrap();
                while let Some(event) = stream.next().await {
                    event.unwrap();
                }
                assert!(
                    client
                        .prepare_outbound_request(minimal_zen_request("minimax-m3"), false)
                        .is_err(),
                    "a request cannot silently change an existing client's protocol"
                );
            } else {
                client

View on GitHub (pinned to 73e0f67d83)