{"record":{"id":"fc3a8a239ad03d01","repo":"zylon-ai/private-gpt","slug":"embedding-model-config-target-model-not-found","errorCode":null,"errorMessage":"Embedding model config '{target_model}' not found. Available: {available}","messagePattern":"Embedding model config '(.+?)' not found\\. Available: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":400,"severity":"error","filePath":"private_gpt/components/embedding/embedding_component.py","lineNumber":136,"sourceCode":"    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\"\n            )\n\n        model_config = self.embed_models.get(target_model)\n        if not model_config:\n            available = list(self.embed_models.keys())\n            raise ValueError(\n                f\"Embedding model config '{target_model}' not found. Available: {available}\"\n            )\n\n        return model_config\n\n    @property\n    def embedding_model(self) -> BaseEmbedding:\n        return self.get_embed()\n\n    @property\n    def alias(self) -> str | None:\n        return self.get_alias()\n\n    @property\n    def config(self) -> EmbeddingModelConfig:\n        return self.get_config()\n","sourceCodeStart":118,"sourceCodeEnd":153,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/embedding/embedding_component.py#L118-L153","documentation":"ValueError from EmbeddingComponent.get_config when target_model resolves to a name that has no entry in the embed_models config dict. The message lists the available config keys (list(self.embed_models.keys())), which may differ from the registry aliases shown by get_embed — a model can be instantiated (registry hit) yet lack a config entry, so the two errors are not interchangeable.","triggerScenarios":"Calling get_config(model_id) with a name not present in the configured embedding models mapping; or a default model whose id is registered in the registry but was never added to embed_models (e.g. programmatically registered models).","commonSituations":"Registering models at runtime without a matching config entry; renaming a model in the models list while callers still request config by the old key; inconsistency between registry aliases and settings keys.","solutions":["Use one of the keys printed in 'Available: [...]'","Add a matching entry for the model under embed_models in embedding settings","Keep registry aliases and embed_models keys in sync when models are registered programmatically","Prefer component.get_embed()/get_alias() when you only need the model instance, not its config"],"exampleFix":"# before\ncfg = component.get_config('old-name')  # ValueError: config not found\n\n# after\ncfg = component.get_config(list(component.embed_models)[0])","handlingStrategy":"validation","validationCode":"keys = list(component.embed_models)\nif target_model not in keys:\n    raise ValueError(f'no config for {target_model!r}; available keys: {keys}')","typeGuard":null,"tryCatchPattern":"try:\n    cfg = component.get_config(model_id)\nexcept ValueError as e:\n    if 'model config' in str(e) and 'Available:' in str(e):\n        cfg = component.get_config(list(component.embed_models)[0])\n    else:\n        raise","preventionTips":["Keep embed_models keys identical to the ids/aliases you register","When registering models programmatically, add a matching config entry in the same place","Prefer registry aliases from get_all_aliases() for user-facing selection"],"tags":["embedding","configuration","model-registry"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}