chatboxai/chatbox · error · Error

Unsupported search provider: ${provider}

Error message

Unsupported search provider: ${provider}

What it means

Thrown by getSearchProviders() in the web-search module when the requested provider value does not match any case in the switch (chatbox/bing/tavily/bocha/querit). It is the default-case guard marking an unsupported/unconfigured search provider as a config error.

Source

Thrown at src/renderer/packages/web-search/index.ts:67

      if (!settings.webSearch.bochaApiKey) {
        throw ChatboxAIAPIError.fromCodeName('bocha_api_key_required', 'bocha_api_key_required')
      }
      selectedProviders.push(new BochaSearch(settings.webSearch.bochaApiKey))
      break
    case 'querit':
      if (!settings.webSearch.queritApiKey) {
        throw ChatboxAIAPIError.fromCodeName('querit_api_key_required', 'querit_api_key_required')
      }
      selectedProviders.push(
        new QueritSearch(
          settings.webSearch.queritApiKey,
          settings.webSearch.queritMaxResults,
          settings.webSearch.queritTimeRange
        )
      )
      break
    default:
      throw new Error(`Unsupported search provider: ${provider}`)
  }

  return selectedProviders
}

async function _searchRelatedResults(query: string, signal?: AbortSignal) {
  const providers = getSearchProviders()
  const results = await Promise.all(
    providers.map(async (provider) => {
      try {
        const result = await provider.search(query, signal)
        console.debug(`web search result for "${query}":`, result.items)
        return result
      } catch (err) {
        console.error(err)
        return { items: [] }
      }
    })

View on GitHub (pinned to 81571269ad)

Solutions

  1. Set the web search provider to one of: chatbox, bing, tavily, bocha, querit (per the current switch cases).
  2. If the provider requires an API key (tavily/bocha/querit), set the corresponding key first.
  3. If a provider was renamed, update settings to the new name via the UI.
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED_PROVIDERS = ['chatbox', 'bing', 'tavily', 'bocha', 'querit'] as const
function isSupportedProvider(p: string): p is typeof SUPPORTED_PROVIDERS[number] {
  return (SUPPORTED_PROVIDERS as readonly string[]).includes(p)
}
if (!isSupportedProvider(settings.webSearch.provider)) {
  // reset to a supported provider; do not call getSearchProviders
}

Type guard

function isSupportedProvider(p: unknown): p is 'chatbox' | 'bing' | 'tavily' | 'bocha' | 'querit' {
  return typeof p === 'string' && ['chatbox', 'bing', 'tavily', 'bocha', 'querit'].includes(p)
}

Try / catch

try {
  const providers = getSearchProviders()
} catch (e) {
  if (e instanceof Error && /Unsupported search provider/.test(e.message)) {
    // reset settings.webSearch.provider to a default and retry
  }
}

Prevention

When it happens

Trigger: settings.webSearch.provider (or whichever variable feeds the switch) holds a value outside the supported set, e.g. a typo, an empty string, or a provider constant that was renamed/removed. The `default:` branch throws.

Common situations: Stale settings from an older app version referencing a removed provider; manual settings edit with a wrong provider name; a new provider was added to docs but not yet to this switch; settings migration left an undefined provider.

Related errors


AI-assisted analysis of chatboxai/chatbox@81571269ad (2026-08-12). Data as JSON: /api/errors/b05decc7478fd989. Report an issue: GitHub.