{"record":{"id":"eab30cab2821ee79","repo":"zylon-ai/private-gpt","slug":"model-config-target-model-not-found-available","errorCode":null,"errorMessage":"Model config '{target_model}' not found. Available: {available}","messagePattern":"Model config '(.+?)' not found\\. Available: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"private_gpt/components/llm/llm_component.py","lineNumber":162,"sourceCode":"            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) -> LLMModelConfig:\n        target_model = model_id or self._default_model_id\n\n        if not target_model:\n            raise ValueError(\"No model specified and no models are configured\")\n\n        model_config = self.llm_models.get(target_model)\n        if not model_config:\n            available = list(self.llm_models.keys())\n            for alias in self.registry.get_aliases(target_model):\n                if alias in self.llm_models:\n                    model_config = self.llm_models[alias]\n                    return model_config\n\n            raise ValueError(\n                f\"Model config '{target_model}' not found. Available: {available}\"\n            )\n\n        return model_config\n\n    def get_tokenizer(self, model_id: str | None = None) -> TokenizerBase | None:\n        target_model = model_id or self._default_model_id\n\n        if not target_model:\n            raise ValueError(\"No model specified and no models are configured\")\n\n        llm_instance = self.registry.get(target_model)\n        if not llm_instance:\n            available = self.registry.get_all_aliases()\n            raise ValueError(\n                f\"Model '{target_model}' not found. Available: {available}\"\n            )\n","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/llm/llm_component.py#L144-L180","documentation":"ValueError from LLMComponent.get_config: target_model is neither a key in llm_models nor resolvable through any of its registered aliases. The method first tries a direct lookup, then aliases; when both fail it lists available model config keys.","triggerScenarios":"Calling get_config(\"foo\") where foo is not in llm.models and none of foo's registry aliases map to a configured model; or foo was skipped during registration (init failure) so no alias exists.","commonSituations":"Typos in model ids; requesting config for a model that failed to register; alias expectations not matching what registration actually recorded.","solutions":["Use one of the keys from the error's Available list.","If the model should be there, fix its startup init failure (see 'Skipping unavailable LLM model' warnings).","Add the model (or its alias) to llm.models in settings."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"def config_exists(component, model_id: str) -> bool:\n    if model_id in component.llm_models:\n        return True\n    return any(\n        alias in component.llm_models\n        for alias in component.registry.get_aliases(model_id)\n    )","typeGuard":null,"tryCatchPattern":"try:\n    cfg = component.get_config(model_id)\nexcept ValueError as e:\n    if 'Model config' in str(e):\n        raise ModelNotFoundError(str(e)) from e\n    raise","preventionTips":["Source model ids from component.llm_models.keys() instead of hardcoding strings.","Log the available-keys list from the error verbatim when surfacing to operators.","Keep alias registration and llm_models keys consistent in settings."],"tags":["configuration","llm","validation"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}