Hmbown/CodeWhale · error · anyhow::Error

active provider has no native web-search adapter

Error message

active provider has no native web-search adapter

What it means

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.

Source

Thrown at crates/tui/src/client/provider_native_search.rs:115

                request,
                ResponsesSearchDialect::Openai,
            ),
            ApiProvider::Xai => build_responses_search_body(
                &self.inner.default_model,
                request,
                ResponsesSearchDialect::Xai,
            ),
            ApiProvider::Anthropic => {
                let route_cap = self
                    .inner
                    .effective_max_output_tokens(&self.inner.default_model);
                build_anthropic_search_body(
                    &self.inner.default_model,
                    request,
                    2_048_u32.min(route_cap),
                )
            }
            _ => bail!("active provider has no native web-search adapter"),
        };
        let url = match self.inner.api_provider {
            ApiProvider::Openai | ApiProvider::Xai => api_url(&self.inner.base_url, "responses"),
            ApiProvider::Anthropic => anthropic_messages_url(&self.inner.base_url),
            _ => unreachable!("provider checked above"),
        };
        let body_bytes = serde_json::to_vec(&body)
            .context("failed to serialize provider-native web-search request")?;
        let response = self
            .inner
            .send_with_retry(|| {
                self.inner
                    .http_client
                    .post(&url)
                    .header("Accept", "application/json")
                    .body(body_bytes.clone())
            })
            .await

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Switch the session to openai, xai, or anthropic to use native web search
  2. Or use a non-native search tool (client-side fetch/search tool) that works on any provider
  3. Gate the search feature flag on the supported-provider set in config

Example fix

// before: native search enabled while provider = google
client.native_web_search(&request).await?; // bails

// after
if !supports_native_search(provider) {
    return run_tool_based_search(&mut session, &request).await;
}
Defensive patterns

Strategy: validation

Validate before calling

use ApiProvider::*;
anyhow::ensure!(
    matches!(client.api_provider, Openai | Xai | Anthropic),
    "native web search unavailable for {}",
    client.api_provider.display_name()
);

Type guard

fn supports_native_search(provider: ApiProvider) -> bool {
    matches!(provider, ApiProvider::Openai | ApiProvider::Xai | ApiProvider::Anthropic)
}

Try / catch

if supports_native_search(client.api_provider) {
    client.native_web_search(request).await
} else {
    run_tool_based_search(&mut session, request).await // fallback search tool
}

Prevention

When it happens

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

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

Related errors


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/c85f6737d7f7dc08. Report an issue: GitHub.