chroma-core/chroma · error · ValueError
The model name cannot be changed after the embedding functio
Error message
The model name cannot be changed after the embedding function has been initialized.
What it means
Error "The model name cannot be changed after the embedding function has been initialized." thrown in chroma-core/chroma.
Source
Thrown at chromadb/utils/embedding_functions/huggingface_embedding_function.py:113
def build_from_config(config: Dict[str, Any]) -> "EmbeddingFunction[Documents]":
api_key_env_var = config.get("api_key_env_var")
model_name = config.get("model_name")
if api_key_env_var is None or model_name is None:
assert False, "This code should not be reached"
return HuggingFaceEmbeddingFunction(
api_key_env_var=api_key_env_var, model_name=model_name
)
def get_config(self) -> Dict[str, Any]:
return {"api_key_env_var": self.api_key_env_var, "model_name": self.model_name}
def validate_config_update(
self, old_config: Dict[str, Any], new_config: Dict[str, Any]
) -> None:
if "model_name" in new_config:
raise ValueError(
"The model name cannot be changed after the embedding function has been initialized."
)
@staticmethod
def validate_config(config: Dict[str, Any]) -> None:
"""
Validate the configuration using the JSON schema.
Args:
config: Configuration to validate
Raises:
ValidationError: If the configuration does not match the schema
"""
validate_config_schema(config, "huggingface")
class HuggingFaceEmbeddingServer(EmbeddingFunction[Documents]):View on GitHub (pinned to aecdd12c8a)
When it happens
Trigger: Thrown at chromadb/utils/embedding_functions/huggingface_embedding_function.py:113 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16).
Data as JSON: /api/errors/c088b0d714ebf89b.
Report an issue: GitHub.