zylon-ai/private-gpt · error · ValueError
Model '{target_model}' not found. Available: {available}
Error message
Model '{target_model}' not found. Available: {available} What it means
ValueError from LLMComponent.get_llm: target_model (the passed model_id or the default) is not in the registry, and the error lists all registered aliases so you can see valid values. Registry keys are model ids plus registered aliases; anything else is rejected.
Source
Thrown at private_gpt/components/llm/llm_component.py:135
raise ValueError(
f"Default model '{self._default_model_id}' not found in registered models"
)
if not self.registry.get(LLMRegistry.default()):
self.registry.register(LLMRegistry.default(), default_instance)
logger.info("Set default model to '%s'", self._default_model_id)
def get_llm(self, model_id: str | None = None) -> LLM:
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}"
)
return llm_instance.llm
def get_alias(self, model_id: str | None = None) -> str | None:
target_model = model_id or self._default_model_id
if not target_model:
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")
View on GitHub (pinned to 4a030776a3)
Solutions
- Use one of the ids/aliases from the error's Available list.
- If the model should exist, check startup logs for 'Skipping unavailable LLM model' and fix its init failure.
- Add the requested id/alias to llm.models in settings if it's genuinely missing.
Example fix
# before
llm = component.get_llm("gpt4o")
# after (exact registered id)
llm = component.get_llm("gpt-4o") Defensive patterns
Strategy: validation
Validate before calling
def model_is_available(component, model_id: str) -> bool:
return component.registry.get(model_id) is not None Type guard
def is_registered_model(component, model_id: object) -> bool:
return isinstance(model_id, str) and component.registry.get(model_id) is not None Try / catch
try:
llm = component.get_llm(model_id)
except ValueError as e:
if 'not found. Available' in str(e):
available = component.registry.get_all_aliases()
raise ModelNotFoundError(f'{model_id} not in {available}') from e
raise Prevention
- Expose the registered alias list via an API/health endpoint so clients choose valid ids.
- Validate user-supplied model ids against the registry before use.
- Check startup warnings for skipped models before assuming a configured id is available.
When it happens
Trigger: Calling get_llm("foo") with an unregistered id; requesting a model whose registration was skipped at startup due to init failure; using an alias that was never registered for the model.
Common situations: API/CLI consumers passing an arbitrary model name; typos in model ids; models that failed to register (check startup warnings) but are still requested.
Related errors
- LLM mode '{mode}' is not supported. 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/5a665a85ff775071.
Report an issue: GitHub.