Fosowl/agenticSeek · error · ValueError
Unknown provider: {provider_name}
Error message
Unknown provider: {provider_name} What it means
LLMProvider.__init__ validates the `provider_name` argument against its `available_providers` dict and raises this ValueError if the name is not registered. It is a configuration-time guard: no network calls or API keys are touched, the provider simply is not supported/known to this library version.
Source
Thrown at sources/llm_provider.py:48
"openai": self.openai_fn,
"lm-studio": self.lm_studio_fn,
"huggingface": self.huggingface_fn,
"google": self.google_fn,
"deepseek": self.deepseek_fn,
"together": self.together_fn,
"dsk_deepseek": self.dsk_deepseek,
"openrouter": self.openrouter_fn,
"anthropic": self.anthropic_fn,
"minimax": self.minimax_fn,
"litellm": self.litellm_fn,
"test": self.test_fn
}
self.logger = Logger("provider.log")
self.api_key = None
self.internal_url, self.in_docker = self.get_internal_url()
self.unsafe_providers = ["openai", "deepseek", "dsk_deepseek", "together", "google", "openrouter", "anthropic", "minimax"]
if self.provider_name not in self.available_providers:
raise ValueError(f"Unknown provider: {provider_name}")
if self.provider_name in self.unsafe_providers and self.is_local == False:
pretty_print("Warning: you are using an API provider. You data will be sent to the cloud.", color="warning")
self.api_key = self.get_api_key(self.provider_name)
elif self.provider_name != "ollama":
pretty_print(f"Provider: {provider_name} initialized at {self.server_ip}", color="success")
def get_model_name(self) -> str:
return self.model
def get_api_key(self, provider):
load_dotenv()
api_key_var = f"{provider.upper()}_API_KEY"
api_key = os.getenv(api_key_var)
if not api_key:
raise ValueError(
f"API key {api_key_var} not found in .env file. "
"Please add it to your .env file and restart the server."
)View on GitHub (pinned to ae57a23577)
Solutions
- Use one of the exact keys in available_providers (e.g. 'openai', 'deepseek', 'dsk_deepseek', 'together', 'google', 'openrouter', 'anthropic', 'minimax', 'ollama').
- Inspect provider.available_providers (or the class source) to list valid names before instantiating.
- Update the library to the latest version if the provider you need was added recently.
- Fix casing/whitespace in the provider string from your config or environment.
Example fix
// before
provider = LLMProvider("chatgpt") # ValueError: Unknown provider: chatgpt
// after
provider = LLMProvider("openai") # exact key from available_providers Defensive patterns
Strategy: validation
Validate before calling
available = set(LLMProvider.__init__.__code__.co_consts) # or read provider.available_providers on an instance/docs
name = (config["provider"] or "").strip().lower()
if name not in available:
raise ValueError(f"provider must be one of {sorted(available)}, got {name!r}") Type guard
def is_known_provider(name, known: set) -> bool:
return isinstance(name, str) and name.strip().lower() in known Try / catch
try:
provider = LLMProvider(requested)
except ValueError as e:
logger.warning(f"{e} - falling back to ollama")
provider = LLMProvider("ollama") Prevention
- Centralize the provider name in one config constant instead of scattering literals.
- Validate provider names at startup with a fail-fast check against available_providers.
- Always lowercase/strip provider strings coming from env/config files.
- Pin the library version and check its release notes when adding a new provider.
When it happens
Trigger: Instantiating LLMProvider('gpt4') or any name not exactly matching a key in available_providers; passing a provider added in a newer version while running an older checkout; case/spacing mistakes ('OpenAI' vs 'openai'); misspelling local providers like 'ollama'.
Common situations: Typos or wrong casing in config files/env-driven provider selection; upgrading the app but not the library so a newly supported provider is unknown; copying a provider name from another tool (e.g. 'azure-openai') that this library does not define.
Related errors
- Model not set
- Prompt file not found at path: {file_path}
- Permission denied to read prompt file at path: {file_path}
- API key {api_key_var} not found in .env file. Please add it
- Deepseek (API) is not available for local use. Change config
AI-assisted analysis of Fosowl/agenticSeek@ae57a23577 (2026-08-30).
Data as JSON: /api/errors/5bcfe089af0a7ee1.
Report an issue: GitHub.