chroma-core/chroma · error · ValueError

The URL cannot be changed after the embedding function has…

Error message

The URL cannot be changed after the embedding function has been initialized.

What it means

Raised by HuggingFaceEmbeddingServer.validate_config_update when an update includes a 'url' key. The inference server URL is immutable after initialization since existing embeddings were computed against that endpoint's model.

Solutions

  1. Keep url unchanged across updates
  2. Create a new HuggingFaceEmbeddingServer instance for a different endpoint
  3. Remove url from the update payload
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at chromadb/utils/embedding_functions/huggingface_embedding_function.py:230 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/3b7c4c54922ba248. Report an issue: GitHub.

Appendix: source

Thrown at chromadb/utils/embedding_functions/huggingface_embedding_function.py:230

        return ["cosine", "l2", "ip"]

    @staticmethod
    def build_from_config(config: Dict[str, Any]) -> "EmbeddingFunction[Documents]":
        url = config.get("url")
        api_key_env_var = config.get("api_key_env_var")
        if url is None:
            raise ValueError("URL must be provided for HuggingFaceEmbeddingServer")

        return HuggingFaceEmbeddingServer(url=url, api_key_env_var=api_key_env_var)

    def get_config(self) -> Dict[str, Any]:
        return {"url": self.url, "api_key_env_var": self.api_key_env_var}

    def validate_config_update(
        self, old_config: Dict[str, Any], new_config: Dict[str, Any]
    ) -> None:
        if "url" in new_config and new_config["url"] != self.url:
            raise ValueError(
                "The URL 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_server")

View on GitHub (pinned to aecdd12c8a)