zylon-ai/private-gpt · error · ValueError
Unsupported web search provider: {self._settings.web_search.
Error message
Unsupported web search provider: {self._settings.web_search.provider} What it means
ValueError raised in WebSearchService._initialize_providers when the configured provider string matches neither 'brave' nor 'mock'. In normal operation the pydantic Literal['brave','mock'] on WebSearchSettings.provider rejects other values at config load, so this branch fires when settings are constructed/bypassed without validation (programmatic Settings mutation, hand-built Settings objects in tests, or a version skew between config schema and code).
Source
Thrown at private_gpt/components/web/web_search/web_search_service.py:101
def _initialize_providers(self) -> None:
if self._settings.web_search.provider == "brave":
from private_gpt.components.web.web_search.providers.brave import (
BraveSearchProvider,
)
self._provider = BraveSearchProvider(self._settings)
elif self._settings.web_search.provider == "mock":
from private_gpt.components.web.web_search.providers.mock import (
MockSearchProvider,
)
self._provider = MockSearchProvider()
else:
logger.error(
f"Unsupported web search provider: {self._settings.web_search.provider}"
)
raise ValueError(
f"Unsupported web search provider: {self._settings.web_search.provider}"
)
if self._settings.web_search.cached:
from private_gpt.components.web.web_search.providers.cached import (
CachedProvider,
)
self._provider = CachedProvider(self._provider)
def _initialize_processor(self) -> None:
if self._settings.web_search.processor == "simple_text":
from private_gpt.components.web.web_search.processors.simple_text import (
SimpleTextProcessor,
)
self._processor = SimpleTextProcessor(self._settings)
View on GitHub (pinned to 4a030776a3)
Solutions
- Set web_search.provider to 'brave' (or 'mock' for tests) — the only supported values in this build.
- If you need a custom provider, register it in both the WebSearchSettings Literal and _initialize_providers, then rebuild.
- Construct Settings through the normal loader so pydantic validation catches bad names at startup, not at first search.
Example fix
# settings.yaml web_search: provider: brave # was e.g. 'serper' (unsupported in this build)
Defensive patterns
Strategy: type-guard
Validate before calling
SUPPORTED_PROVIDERS = {'brave', 'mock'}
if settings.web_search.provider not in SUPPORTED_PROVIDERS:
raise ValueError(
f'provider must be one of {sorted(SUPPORTED_PROVIDERS)}, '
f'got {settings.web_search.provider!r}'
) Type guard
from typing import Literal
WebSearchProviderName = Literal['brave', 'mock']
def is_supported_provider(name: str) -> bool:
return name in ('brave', 'mock') Try / catch
try:
svc = WebSearchService(settings, scraper, llm, summary_builder)
except ValueError as e:
if 'Unsupported web search provider' in str(e):
settings.web_search.provider = 'brave' # safe default
svc = WebSearchService(settings, scraper, llm, summary_builder)
else:
raise Prevention
- Always build Settings via the pydantic loader so Literal validation runs.
- Extend the Literal when adding providers, keep the branch list in sync.
- Fail config validation at boot, not at first search.
When it happens
Trigger: Settings object built or mutated in code (settings.web_search.provider = 'serper') and passed to a manually constructed WebSearchService; older config files from versions where other provider names existed; test fixtures instantiating WebSearchSettings with validate_assignment off.
Common situations: Extending private-gpt with a custom search provider without patching the Literal and the branch; YAML from an older/newer release carrying a provider name this build does not know.
Related errors
- Web fetching is not properly initialized or it is disabled.
- Web fetching is not properly initialized or it is disabled.
- Unknown processor: {self._settings.web_search.processor}. Av
- Code execution provider '{name}' is not registered. Availabl
- TOOL_NAME_CONFLICT
AI-assisted analysis of zylon-ai/private-gpt@4a030776a3 (2026-08-15).
Data as JSON: /api/errors/ea85700975621c46.
Report an issue: GitHub.