zylon-ai/private-gpt · error · ValueError

No embedding model specified and no models are configured

Error message

No embedding model specified and no models are configured

What it means

ValueError from EmbeddingComponent.get_embed when neither an explicit model_id nor a configured default (_default_model_id) exists. The method resolves target_model = model_id or self._default_model_id; if that falsifies, no embedding can be produced and the call aborts before touching the registry. It is purely a configuration/usage error, not a model-loading failure.

Source

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

                "No default embedding model configured. Auto-selecting: '%s'",
                self._default_model_id,
            )

        if self._default_model_id:
            if not self.registry.get(self._default_model_id) and not self.registry.get(
                EmbeddingRegistry.default()
            ):
                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

View on GitHub (pinned to 4a030776a3)

Solutions

  1. Configure at least one embedding model and set it as default in settings (embedding.default model / models list)
  2. Or pass model_id explicitly on every get_embed call
  3. Check that the settings profile actually loaded (log the embedding config at startup)
  4. In tests, register a mock embedding model so the default resolves

Example fix

# before
embed = component.get_embed()  # ValueError: no default configured

# after (settings.yaml)
# embedding:
#   default_model: text-embedding-3-small
embed = component.get_embed()
Defensive patterns

Strategy: validation

Validate before calling

if not component.get_alias() and not any_request_model_id:
    raise RuntimeError('no embedding model configured; set embedding.default_model or pass model_id')

Try / catch

try:
    embed = component.get_embed(model_id)
except ValueError as e:
    if 'No embedding model specified' in str(e):
        raise SystemExit('configure embedding.default_model in settings') from e
    raise

Prevention

When it happens

Trigger: Calling get_embed() with no argument while the embedding section of Settings defines no default model (or the component was built from an empty registry and default), e.g. when embedding models list is empty or the default id is None/unset.

Common situations: Fresh deployment with the embedding block of settings.yaml omitted or empty; profile/config overlay accidentally dropping the embedding.models list; code that assumed a built-in default; tests constructing EmbeddingComponent with no models.

Related errors


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