{"record":{"id":"a01183e3c0097484","repo":"zylon-ai/private-gpt","slug":"embedding-model-target-model-not-found-availa","errorCode":null,"errorMessage":"Embedding model '{target_model}' not found. Available: {available}","messagePattern":"Embedding model '(.+?)' not found\\. Available: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":400,"severity":"error","filePath":"private_gpt/components/embedding/embedding_component.py","lineNumber":112,"sourceCode":"            ):\n                raise ValueError(\n                    f\"Default model '{self._default_model_id}' not found in registered models\"\n                )\n\n            logger.info(\"Set default model to '%s'\", self._default_model_id)\n\n    def get_embed(self, model_id: str | None = None) -> BaseEmbedding:\n        target_model = model_id or self._default_model_id\n\n        if not target_model:\n            raise ValueError(\n                \"No embedding model specified and no models are configured\"\n            )\n\n        embed = self.registry.get(target_model)\n        if not embed:\n            available = self.registry.get_all_aliases()\n            raise ValueError(\n                f\"Embedding model '{target_model}' not found. Available: {available}\"\n            )\n\n        return embed\n\n    def get_alias(self, model_id: str | None = None) -> str | None:\n        target_model = model_id or self._default_model_id\n        if not target_model:\n            return None\n        aliases = self.registry.get_aliases(target_model)\n        return aliases.pop() if aliases else None\n\n    def get_config(self, model_id: str | None = None) -> EmbeddingModelConfig:\n        target_model = model_id or self._default_model_id\n\n        if not target_model:\n            raise ValueError(\n                \"No embedding model specified and no models are configured\"","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/embedding/embedding_component.py#L94-L130","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Use one of the names printed in 'Available: [...]' in the error","Add/adjust the model entry (or its alias) in embedding settings so the requested name is registered at startup","If the model should exist, check startup logs — its factory may have failed during registration","Guard call sites with component.registry.get_all_aliases() when the name comes from user input"],"exampleFix":"# before\nembed = component.get_embed('openai-embed')  # not an alias\n\n# after\nembed = component.get_embed(component.registry.get_all_aliases()[0])","handlingStrategy":"validation","validationCode":"aliases = component.registry.get_all_aliases()\nif model_id and model_id not in aliases:\n    raise ValueError(f'unknown embedding model {model_id!r}; pick from {aliases}')","typeGuard":null,"tryCatchPattern":"try:\n    embed = component.get_embed(model_id)\nexcept ValueError as e:\n    if 'not found. Available:' in str(e):\n        embed = component.get_embed(component.registry.get_all_aliases()[0])  # explicit fallback choice\n    else:\n        raise","preventionTips":["Source model names from registry.get_all_aliases(), never hardcode provider names","Log available aliases at startup so mismatches are visible immediately","Validate user-supplied model ids against the alias list at the API boundary"],"tags":["embedding","configuration","model-registry"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}