{"record":{"id":"c088b0d714ebf89b","repo":"chroma-core/chroma","slug":"the-model-name-cannot-be-changed-after-the-embeddi-c088b0","errorCode":null,"errorMessage":"The model name cannot be changed after the embedding function has been initialized.","messagePattern":"The model name cannot be changed after the embedding function has been initialized\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/utils/embedding_functions/huggingface_embedding_function.py","lineNumber":113,"sourceCode":"    def build_from_config(config: Dict[str, Any]) -> \"EmbeddingFunction[Documents]\":\n        api_key_env_var = config.get(\"api_key_env_var\")\n        model_name = config.get(\"model_name\")\n\n        if api_key_env_var is None or model_name is None:\n            assert False, \"This code should not be reached\"\n\n        return HuggingFaceEmbeddingFunction(\n            api_key_env_var=api_key_env_var, model_name=model_name\n        )\n\n    def get_config(self) -> Dict[str, Any]:\n        return {\"api_key_env_var\": self.api_key_env_var, \"model_name\": self.model_name}\n\n    def validate_config_update(\n        self, old_config: Dict[str, Any], new_config: Dict[str, Any]\n    ) -> None:\n        if \"model_name\" in new_config:\n            raise ValueError(\n                \"The model name cannot be changed after the embedding function has been initialized.\"\n            )\n\n    @staticmethod\n    def validate_config(config: Dict[str, Any]) -> None:\n        \"\"\"\n        Validate the configuration using the JSON schema.\n\n        Args:\n            config: Configuration to validate\n\n        Raises:\n            ValidationError: If the configuration does not match the schema\n        \"\"\"\n        validate_config_schema(config, \"huggingface\")\n\n\nclass HuggingFaceEmbeddingServer(EmbeddingFunction[Documents]):","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/utils/embedding_functions/huggingface_embedding_function.py#L95-L131","documentation":"Error \"The model name cannot be changed after the embedding function has been initialized.\" thrown in chroma-core/chroma.","triggerScenarios":"Thrown at chromadb/utils/embedding_functions/huggingface_embedding_function.py:113 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}