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

  1. Read the error's 'Available: ...' list and use one of those exact mode strings.
  2. Check settings (yaml/env) for the llm mode key and fix the typo/casing.
  3. 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

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


AI-assisted analysis of zylon-ai/private-gpt@4a030776a3 (2026-08-15). Data as JSON: /api/errors/c50a20d220995ff8. Report an issue: GitHub.