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

The native web-search adapter maps each supported provider to a provider-specific request body and URL. When the active provider has no adapter entry (the `_` catch-all in the match), native search is simply not implemented for it, and the call fails with this explicit bail rather than silently degrading to a non-native path. Raised in `search` in `crates/tui/src/client/provider_native_search.rs` around line 159.

Solutions

  1. Switch to a provider with a native search adapter (OpenAI, xAI, ModelStudio token plan, DeepSeek, Xiaomi MiMo, Z.ai).
  2. Use the non-native search path (external search tooling) for unsupported providers.
  3. If the provider does support server-side search upstream, implement a `build_*_search_body` adapter and URL mapping for it.
Defensive patterns

Strategy: fallback

Validate before calling

fn has_native_search(provider: ApiProvider) -> bool {
    matches!(provider,
        ApiProvider::Openai | ApiProvider::Xai | ApiProvider::ModelstudioTokenPlan
        | ApiProvider::Deepseek | ApiProvider::DeepseekCN
        | ApiProvider::XiaomiMimo | ApiProvider::Zai)
}

Type guard

fn supports_native_search(c: &Client) -> bool { has_native_search(c.api_provider) }

Try / catch

if supports_native_search(&client) {
    client.native_search(query).await
} else {
    fallback_external_search(query).await // tool-based search instead of provider-native
}

Prevention

When it happens

Trigger: Calling native web search while the active provider is one without a dedicated adapter (anything not Openai, Xai, ModelstudioTokenPlan, Deepseek, DeepseekCN, XiaomiMimo, Zai, and the other explicitly matched arms).

Common situations: Configuring a generic OpenAI-compatible endpoint or smaller provider and expecting built-in server-side web search; switching the default provider to one that lacks native search; assuming search works on all routes because it works on the big ones.

Related errors


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

Appendix: source

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

            ),
            ApiProvider::Deepseek | ApiProvider::DeepseekCN => build_responses_search_body(
                &self.inner.default_model,
                request,
                ResponsesSearchDialect::Deepseek,
            ),
            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),
                )
            }
            ApiProvider::XiaomiMimo => build_mimo_search_body(&self.inner.default_model, request),
            ApiProvider::Zai => zai::build_body(request, &self.inner.base_url)?,
            _ => bail!("active provider has no native web-search adapter"),
        };
        let url = match self.inner.api_provider {
            ApiProvider::Openai | ApiProvider::Xai | ApiProvider::ModelstudioTokenPlan => {
                api_url(&self.inner.base_url, "responses")
            }
            ApiProvider::Deepseek | ApiProvider::DeepseekCN => {
                responses_api_url(&self.inner.base_url, self.inner.api_provider)
            }
            ApiProvider::Anthropic => anthropic_messages_url(&self.inner.base_url),
            ApiProvider::XiaomiMimo => api_url(&self.inner.base_url, "chat/completions"),
            ApiProvider::Zai => api_url(&self.inner.base_url, "web_search"),
            _ => 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(|| {

View on GitHub (pinned to 73e0f67d83)