chroma-core/chroma · error · NotImplementedError

Updating a ChromaLangchainEmbeddingFunction config is not su

Error message

Updating a ChromaLangchainEmbeddingFunction config is not supported. Please recreate the langchain embedding function and pass it to create_langchain_embedding.

What it means

ChromaLangchainEmbeddingFunction wraps an arbitrary LangChain embedding object that cannot be serialized into Chroma's embedding-function config format; get_config() only returns a placeholder. Because the real object exists only at runtime, validate_config_update() unconditionally raises NotImplementedError for any attempted change. Updating a langchain-wrapped embedding function is by design impossible.

Source

Thrown at chromadb/utils/embedding_functions/chroma_langchain_embedding_function.py:155

    ) -> "EmbeddingFunction[Union[Documents, Images]]":
        # This is a placeholder implementation since we can't easily serialize and deserialize
        # langchain embedding functions. Users will need to recreate the langchain embedding function
        # and pass it to create_langchain_embedding.
        raise NotImplementedError(
            "Building a ChromaLangchainEmbeddingFunction from config is not supported. "
            "Please recreate the langchain embedding function and pass it to create_langchain_embedding."
        )

    def get_config(self) -> Dict[str, Any]:
        return {
            "embedding_function_class": self._embedding_function_class,
            "note": "This is a placeholder config. You will need to recreate the langchain embedding function.",
        }

    def validate_config_update(
        self, old_config: Dict[str, Any], new_config: Dict[str, Any]
    ) -> None:
        raise NotImplementedError(
            "Updating a ChromaLangchainEmbeddingFunction config is not supported. "
            "Please recreate the langchain embedding function and pass it to create_langchain_embedding."
        )

    @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, "chroma_langchain")

View on GitHub (pinned to aecdd12c8a)

Solutions

  1. Rebuild the wrapper: create a fresh LangChain embedding object and pass it to chromadb.utils.embedding_functions.create_langchain_embedding(embeddings=...), then use it on a (new) collection.
  2. Create a new collection with the new embedding function and re-embed the data - vectors from different models are not comparable anyway.
  3. If you only need to change collection name/metadata, call collection.modify() with those fields and leave the embedding function untouched.

Example fix

# before
langchain_ef.validate_config_update(old_cfg, {'model': 'x'})  # NotImplementedError

# after
from chromadb.utils.embedding_functions import create_langchain_embedding
from langchain_openai import OpenAIEmbeddings
ef = create_langchain_embedding(OpenAIEmbeddings(model='text-embedding-3-small'))
col = client.create_collection('docs_v2', embedding_function=ef)  # recreate, don't update
Defensive patterns

Strategy: try-catch

Validate before calling

cfg = ef.get_config()
if 'embedding_function_class' in cfg:
    raise SystemExit('Langchain EF detected: config updates are unsupported; recreate the embedding function instead')

Type guard

def is_langchain_ef(ef) -> bool:
    cfg = ef.get_config() if hasattr(ef, 'get_config') else {}
    return 'embedding_function_class' in cfg

Try / catch

try:
    ef.validate_config_update(old_cfg, new_cfg)
except NotImplementedError:
    from chromadb.utils.embedding_functions import create_langchain_embedding
    ef = create_langchain_embedding(build_new_langchain_embeddings())  # recreate instead of update

Prevention

When it happens

Trigger: Any config-update path that reaches ChromaLangchainEmbeddingFunction.validate_config_update(old_config, new_config) on an embedding function created via chromadb.utils.embedding_functions.create_langchain_embedding() - e.g. collection.modify() with embedding-function config changes. The raise fires regardless of what new_config contains.

Common situations: Trying to tweak the wrapped model or credentials on an existing collection instead of recreating it; automation that echoes get_config() output into an update call; migrating a collection from one LangChain embedder to another via the update API.

Related errors


AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16). Data as JSON: /api/errors/27017ab21946ec18. Report an issue: GitHub.