{"record":{"id":"c33ed72c9f1c73da","repo":"Hmbown/CodeWhale","slug":"opencode-zen-client-should-resolve-its-model-route","errorCode":null,"errorMessage":"OpenCode Zen client should resolve its model route","messagePattern":"OpenCode Zen client should resolve its model route","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/client.rs","lineNumber":7946,"sourceCode":"        crate::provider_catalog_live::reset_cache_for_test();\n        crate::provider_lake::clear_live_snapshot();\n    }\n\n    fn opencode_zen_client(server: &MockServer, model: &str) -> CodewhaleClient {\n        let config = Config {\n            provider: Some(\"opencode-zen\".to_string()),\n            providers: Some(ProvidersConfig {\n                opencode_zen: ProviderConfig {\n                    api_key: Some(\"zen-test-key\".to_string()),\n                    base_url: Some(server.uri()),\n                    model: Some(model.to_string()),\n                    ..ProviderConfig::default()\n                },\n                ..ProvidersConfig::default()\n            }),\n            ..Config::default()\n        };\n        CodewhaleClient::new(&config).expect(\"OpenCode Zen client should resolve its model route\")\n    }\n\n    fn minimal_zen_request(model: &str) -> MessageRequest {\n        translation_message_request(\"hello\", model.to_string(), \"English\", 4096)\n    }\n\n    fn assert_zen_bearer_without_codex_headers(request: &wiremock::Request) {\n        assert_eq!(\n            request\n                .headers\n                .get(AUTHORIZATION)\n                .and_then(|value| value.to_str().ok()),\n            Some(\"Bearer zen-test-key\")\n        );\n        for forbidden in [\n            \"openai-beta\",\n            \"originator\",\n            \"chatgpt-account-id\",","sourceCodeStart":7928,"sourceCodeEnd":7964,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/client.rs#L7928-L7964","documentation":"This `expect` panics when `CodewhaleClient::new(&config)` returns `Err`, aborting with 'OpenCode Zen client should resolve its model route' at crates/tui/src/client.rs:7946. Client construction validates the providers config and must be able to resolve the configured model to a concrete route (provider, base URL, wire format); if the model id cannot be matched to a catalog offering or provider entry, construction fails.","triggerScenarios":"Calling `CodewhaleClient::new` with a `ProvidersConfig` whose model id (e.g. an `openai/...` or `anthropic/...` name) has no matching provider entry, or whose provider config lacks `base_url`/api-key material needed to resolve the route.","commonSituations":"Renamed or removed model ids in the provider catalog; a provider namespace (`openai/`) that maps to an unexpected endpoint unless configured; missing `CODEWHALE_HOME` or live-snapshot fixture so the route table is empty; typo'd model strings in test configs.","solutions":["Log the construction error to see which model/provider failed to resolve","Ensure the model id exactly matches a catalog offering (compare with the live snapshot or fixture catalog)","Set `CODEWHALE_HOME` to a fixture home and reset/populate the catalog cache before construction (`reset_cache_for_test`, `record_success` as in the passing tests)","Add the missing provider entry (base_url, api_key, wire format) to `ProvidersConfig`"],"exampleFix":"// before\nCodewhaleClient::new(&config).expect(\"OpenCode Zen client should resolve its model route\")\n// after\nCodewhaleClient::new(&config)\n    .unwrap_or_else(|e| panic!(\"OpenCode Zen client should resolve its model route: {e:?}\"))","handlingStrategy":"validation","validationCode":"// before constructing, verify the model resolves in the catalog\nassert!(catalog.offerings.iter().any(|o| o.id == model_id),\n    \"model {model_id} not present in catalog\");","typeGuard":null,"tryCatchPattern":"let client = CodewhaleClient::new(&config)\n    .unwrap_or_else(|e| panic!(\"OpenCode Zen client should resolve its model route: {e:?}\"));","preventionTips":["Seed CODEWHALE_HOME and the catalog cache before building clients","Keep model ids in tests in sync with catalog fixtures","Fail loud at config load when a model route cannot be resolved"],"tags":["rust","config","provider-routing"],"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"}