zylon-ai/private-gpt · critical · ValueError
Default model '{self._default_model_id}' not found in regist
Error message
Default model '{self._default_model_id}' not found in registered models What it means
ValueError from LLMComponent setup: after registering models, the configured default model id is not present in the registry. This happens when the default id was never registered — its config was skipped earlier (e.g. init failure for a non-default path, empty model list, or a settings key mismatch between default_model_id and llm_models keys).
Source
Thrown at private_gpt/components/llm/llm_component.py:117
f"Default LLM model '{model_id}' could not be initialized: {e}"
) from e
logger.warning(
"Skipping unavailable LLM model '%s': %s",
model_id,
e,
)
if not self._default_model_id and registered_model_ids:
self._default_model_id = next(iter(self.llm_models))
logger.warning(
"No default LLM model configured. Auto-selecting: '%s'",
self._default_model_id,
)
if self._default_model_id:
default_instance = self.registry.get(self._default_model_id)
if not default_instance:
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(View on GitHub (pinned to 4a030776a3)
Solutions
- Compare default_model_id against the exact keys of llm.models in settings (watch indentation, casing, quotes).
- Rename the default to an existing, successfully registered model id.
- If the model exists but failed to register, fix its init error first (see the skip warnings in logs).
Example fix
# before
llm:
default_model: gpt4-old
models:
gpt4-old: {...} # typo/renamed
# after
llm:
default_model: gpt-4o
models:
gpt-4o: {...} Defensive patterns
Strategy: validation
Validate before calling
def default_model_is_registered(settings) -> bool:
default = settings.llm.default_model
return default is not None and default in (settings.llm.models or {}) Try / catch
try:
component = LLMComponent()
except ValueError as e:
if 'not found in registered models' in str(e):
# fix default_model vs llm.models keys, then restart
raise ConfigError(str(e)) from e
raise Prevention
- Add a settings test asserting default_model is a key of llm.models.
- Use YAML schema validation (pydantic settings) so key mismatches fail at parse time.
- After renaming models, grep settings for stale references to old ids.
When it happens
Trigger: settings specify default_model_id: X but no entry X exists under llm.models (name mismatch, indentation error in YAML), or X failed to register while another model was default-eligible.
Common situations: YAML indentation moving the default under the wrong key; renaming a model without updating default_model_id; model entries disabled/removed while the default still points at the old name.
Related errors
- Default LLM model '{model_id}' could not be initialized: {e}
- No model specified and no models are configured
- Config file has no top-level mapping: {path}
- Settings file not found for profile '{profile}'. Searched in
- Environment variable {env_var} is not set and not default wa
AI-assisted analysis of zylon-ai/private-gpt@4a030776a3 (2026-08-15).
Data as JSON: /api/errors/c4ddccfab9bf711c.
Report an issue: GitHub.