zylon-ai/private-gpt · error · ValueError

Model config '{target_model}' not found. Available: {availab

Error message

Model config '{target_model}' not found. Available: {available}

What it means

ValueError from LLMComponent.get_config: target_model is neither a key in llm_models nor resolvable through any of its registered aliases. The method first tries a direct lookup, then aliases; when both fail it lists available model config keys.

Source

Thrown at private_gpt/components/llm/llm_component.py:162

            return None
        aliases = self.registry.get_aliases(target_model)
        return aliases.pop() if aliases else None

    def get_config(self, model_id: str | None = None) -> LLMModelConfig:
        target_model = model_id or self._default_model_id

        if not target_model:
            raise ValueError("No model specified and no models are configured")

        model_config = self.llm_models.get(target_model)
        if not model_config:
            available = list(self.llm_models.keys())
            for alias in self.registry.get_aliases(target_model):
                if alias in self.llm_models:
                    model_config = self.llm_models[alias]
                    return model_config

            raise ValueError(
                f"Model config '{target_model}' not found. Available: {available}"
            )

        return model_config

    def get_tokenizer(self, model_id: str | None = None) -> TokenizerBase | None:
        target_model = model_id or self._default_model_id

        if not target_model:
            raise ValueError("No model specified and no models are configured")

        llm_instance = self.registry.get(target_model)
        if not llm_instance:
            available = self.registry.get_all_aliases()
            raise ValueError(
                f"Model '{target_model}' not found. Available: {available}"
            )

View on GitHub (pinned to 4a030776a3)

Solutions

  1. Use one of the keys from the error's Available list.
  2. If the model should be there, fix its startup init failure (see 'Skipping unavailable LLM model' warnings).
  3. Add the model (or its alias) to llm.models in settings.
Defensive patterns

Strategy: validation

Validate before calling

def config_exists(component, model_id: str) -> bool:
    if model_id in component.llm_models:
        return True
    return any(
        alias in component.llm_models
        for alias in component.registry.get_aliases(model_id)
    )

Try / catch

try:
    cfg = component.get_config(model_id)
except ValueError as e:
    if 'Model config' in str(e):
        raise ModelNotFoundError(str(e)) from e
    raise

Prevention

When it happens

Trigger: Calling get_config("foo") where foo is not in llm.models and none of foo's registry aliases map to a configured model; or foo was skipped during registration (init failure) so no alias exists.

Common situations: Typos in model ids; requesting config for a model that failed to register; alias expectations not matching what registration actually recorded.

Related errors


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