zylon-ai/private-gpt · error · ValueError

Embedding model '{target_model}' not found. Available: {avai

Error message

Embedding model '{target_model}' not found. Available: {available}

What it means

ValueError from EmbeddingComponent.get_embed when target_model (explicit model_id or the configured default) is not present in the component's registry. The error message lists every alias from registry.get_all_aliases(), so the fix is to either use one of those names or register the model under the requested alias. Note the default-model check at startup is separate — this fires at lookup time.

Source

Thrown at private_gpt/components/embedding/embedding_component.py:112

            ):
                raise ValueError(
                    f"Default model '{self._default_model_id}' not found in registered models"
                )

            logger.info("Set default model to '%s'", self._default_model_id)

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

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

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

        return embed

    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) -> EmbeddingModelConfig:
        target_model = model_id or self._default_model_id

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

View on GitHub (pinned to 4a030776a3)

Solutions

  1. Use one of the names printed in 'Available: [...]' in the error
  2. Add/adjust the model entry (or its alias) in embedding settings so the requested name is registered at startup
  3. If the model should exist, check startup logs — its factory may have failed during registration
  4. Guard call sites with component.registry.get_all_aliases() when the name comes from user input

Example fix

# before
embed = component.get_embed('openai-embed')  # not an alias

# after
embed = component.get_embed(component.registry.get_all_aliases()[0])
Defensive patterns

Strategy: validation

Validate before calling

aliases = component.registry.get_all_aliases()
if model_id and model_id not in aliases:
    raise ValueError(f'unknown embedding model {model_id!r}; pick from {aliases}')

Try / catch

try:
    embed = component.get_embed(model_id)
except ValueError as e:
    if 'not found. Available:' in str(e):
        embed = component.get_embed(component.registry.get_all_aliases()[0])  # explicit fallback choice
    else:
        raise

Prevention

When it happens

Trigger: Calling get_embed('some-name') where 'some-name' is neither a registered model id nor an alias (case-sensitive), or having a default_model in settings that was never registered (e.g. its factory failed silently at startup or the mode mismatched).

Common situations: Renaming a model in settings but leaving stale references in code; using the provider model name (e.g. 'text-embedding-3-small') where the component expects the registered alias; typo/case mismatch; model registration skipped because the embedding mode had no factory for it.

Related errors


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