{"record":{"id":"c85f6737d7f7dc08","repo":"Hmbown/CodeWhale","slug":"active-provider-has-no-native-web-search-adapter","errorCode":null,"errorMessage":"active provider has no native web-search adapter","messagePattern":"active provider has no native web-search adapter","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/client/provider_native_search.rs","lineNumber":115,"sourceCode":"                request,\n                ResponsesSearchDialect::Openai,\n            ),\n            ApiProvider::Xai => build_responses_search_body(\n                &self.inner.default_model,\n                request,\n                ResponsesSearchDialect::Xai,\n            ),\n            ApiProvider::Anthropic => {\n                let route_cap = self\n                    .inner\n                    .effective_max_output_tokens(&self.inner.default_model);\n                build_anthropic_search_body(\n                    &self.inner.default_model,\n                    request,\n                    2_048_u32.min(route_cap),\n                )\n            }\n            _ => bail!(\"active provider has no native web-search adapter\"),\n        };\n        let url = match self.inner.api_provider {\n            ApiProvider::Openai | ApiProvider::Xai => api_url(&self.inner.base_url, \"responses\"),\n            ApiProvider::Anthropic => anthropic_messages_url(&self.inner.base_url),\n            _ => unreachable!(\"provider checked above\"),\n        };\n        let body_bytes = serde_json::to_vec(&body)\n            .context(\"failed to serialize provider-native web-search request\")?;\n        let response = self\n            .inner\n            .send_with_retry(|| {\n                self.inner\n                    .http_client\n                    .post(&url)\n                    .header(\"Accept\", \"application/json\")\n                    .body(body_bytes.clone())\n            })\n            .await","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/client/provider_native_search.rs#L97-L133","documentation":"Provider-native web search builds a request body only for providers with a proven adapter: OpenAI and xAI (Responses dialect variants) and Anthropic (messages with server-side search). Every other provider falls into the catch-all arm and bails before any URL or body is constructed. The unreachable arm after the URL match confirms only those three providers are ever valid here.","triggerScenarios":"Invoking the native web-search path while `self.inner.api_provider` is anything other than Openai, Xai, or Anthropic — e.g. Google, DeepSeek, Antigravity, or opencode zen.","commonSituations":"Enabling native web search in config, then switching the active provider to one without an adapter; assuming search support follows model capability rather than provider adapter availability.","solutions":["Switch the session to openai, xai, or anthropic to use native web search","Or use a non-native search tool (client-side fetch/search tool) that works on any provider","Gate the search feature flag on the supported-provider set in config"],"exampleFix":"// before: native search enabled while provider = google\nclient.native_web_search(&request).await?; // bails\n\n// after\nif !supports_native_search(provider) {\n    return run_tool_based_search(&mut session, &request).await;\n}","handlingStrategy":"validation","validationCode":"use ApiProvider::*;\nanyhow::ensure!(\n    matches!(client.api_provider, Openai | Xai | Anthropic),\n    \"native web search unavailable for {}\",\n    client.api_provider.display_name()\n);","typeGuard":"fn supports_native_search(provider: ApiProvider) -> bool {\n    matches!(provider, ApiProvider::Openai | ApiProvider::Xai | ApiProvider::Anthropic)\n}","tryCatchPattern":"if supports_native_search(client.api_provider) {\n    client.native_web_search(request).await\n} else {\n    run_tool_based_search(&mut session, request).await // fallback search tool\n}","preventionTips":["Bind the web-search feature flag to the supported-provider set in config","Prefer tool-based search when provider portability matters","Treat the adapter list as the contract; model capability does not imply search support"],"tags":["web-search","provider-capability","anthropic","openai","xai","rust"],"backgroundTag":"unsupported-provider-feature","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}