zylon-ai/private-gpt · error · ValueError
LLM mode '{mode}' is not supported. Available: {available}
Error message
LLM mode '{mode}' is not supported. Available: {available} What it means
ValueError from LLMFactoryRegistry.get_factory: the requested LLM mode string is not a key in the provider registry. The registry is built from a fixed _PROVIDERS mapping; anything outside it (including typos or modes whose factory failed to register) is rejected with a list of valid modes.
Source
Thrown at private_gpt/components/llm/factories/registry.py:33
}
def register_llm(mode: str, provider: LLMProvider) -> None:
_PROVIDERS[mode] = provider
class LLMFactoryRegistry:
"""Registry of LLM factories by mode."""
def __init__(self, settings: Settings):
self._factories: dict[str, LLMFactory] = {
mode: provider(settings) for mode, provider in _PROVIDERS.items()
}
def get_factory(self, mode: str) -> LLMFactory:
if mode not in self._factories:
available = ", ".join(sorted(self._factories)) or "none"
raise ValueError(
f"LLM mode '{mode}' is not supported. Available: {available}"
)
return self._factories[mode]
View on GitHub (pinned to 4a030776a3)
Solutions
- Read the error's 'Available: ...' list and use one of those exact mode strings.
- Check settings (yaml/env) for the llm mode key and fix the typo/casing.
- If you expect the mode to exist, verify your project version — the registry in your checkout defines which modes are valid.
Example fix
# before llm: mode: openai-chat # after (use a mode from the error's Available list) llm: mode: openai
Defensive patterns
Strategy: validation
Validate before calling
VALID_MODES = {"openai", "openai-like"} # mirror the registry's Available list
def mode_is_supported(mode: str, registry) -> bool:
return mode in registry._factories # or keep your own allowlist in sync Type guard
def is_supported_mode(mode: object) -> bool:
return isinstance(mode, str) and mode in KNOWN_MODES Try / catch
try:
factory = registry.get_factory(mode)
except ValueError as e:
match = re.search(r"Available: (.+)", str(e))
raise ConfigError(f"Bad llm mode {mode!r}; valid: {match.group(1) if match else 'unknown'}") from e Prevention
- Validate llm.mode against the registry's keys at config-load time with a clear error message.
- Treat mode names as an API contract: add a config test that asserts your settings' mode is registered.
- Re-validate settings after upgrading the library — mode sets change between versions.
When it happens
Trigger: Passing an unknown mode string to get_factory — e.g. from settings (llm.mode), a CLI arg, or an API request. Typos like 'openai_completions' vs 'openai-completions', or a mode name from an older/newer version of the project, trigger it.
Common situations: Copying a settings.yaml from another version where mode names changed; env var LLM_MODE misspelled; default settings file lacking the mode key so a placeholder is used.
Related errors
- Model '{target_model}' not found. Available: {available}
- No model specified and no models are configured
- Model config '{target_model}' not found. Available: {availab
- Unknown memory type: {type}
- Audio blocks found but no audio-capable LLM provided.
AI-assisted analysis of zylon-ai/private-gpt@4a030776a3 (2026-08-15).
Data as JSON: /api/errors/c50a20d220995ff8.
Report an issue: GitHub.