chroma-core/chroma · error · ValueError

Could not build embedding function {ef_config['name']} from

Error message

Could not build embedding function {ef_config['name']} from config {ef_config['config']}: {e}

What it means

The embedding function name resolved in the registry, but rebuilding it failed: validate_embedding_function_config_is_safe() rejected the config, or build_from_config() raised (missing/wrongly-typed parameters, model files unavailable, config written by a different chromadb version). The original exception is appended to the message, so the tail of the string carries the real cause.

Source

Thrown at chromadb/api/collection_configuration.py:105

            ef = None
        else:
            try:
                ef_name = ef_config["name"]
            except KeyError:
                raise ValueError(
                    f"Embedding function name not found in config: {ef_config}"
                )
            try:
                ef = known_embedding_functions[ef_name]
            except KeyError:
                raise ValueError(
                    f"Embedding function {ef_name} not found. Add @register_embedding_function decorator to the class definition."
                )
            try:
                validate_embedding_function_config_is_safe(ef_name, ef_config["config"])
                ef = ef.build_from_config(ef_config["config"])  # type: ignore
            except Exception as e:
                raise ValueError(
                    f"Could not build embedding function {ef_config['name']} from config {ef_config['config']}: {e}"
                )
    else:
        ef = None

    return CollectionConfiguration(
        hnsw=hnsw_config,
        spann=spann_config,
        embedding_function=ef,  # type: ignore
    )


def collection_configuration_to_json_str(config: CollectionConfiguration) -> str:
    return json.dumps(collection_configuration_to_json(config))


def collection_configuration_to_json(config: CollectionConfiguration) -> Dict[str, Any]:
    if isinstance(config, dict):

View on GitHub (pinned to aecdd12c8a)

Solutions

  1. Read the {e} suffix of the message — it is the underlying validation/build error and names the offending parameter.
  2. Align chromadb versions between the process that created the collection and the one loading it.
  3. For local-model EFs (e.g. ONNX MiniLM), ensure the model files/cache are present on the loading machine.
  4. Recreate the collection with a valid, current embedding function config and re-embed if necessary.
Defensive patterns

Strategy: validation

Validate before calling

from chromadb.utils.embedding_functions import known_embedding_functions
from chromadb.utils.embedding_functions.config_validation import (
    validate_embedding_function_config_is_safe,
)

def dry_run_build(name: str, config: dict):
    ef = known_embedding_functions[name]
    validate_embedding_function_config_is_safe(name, config)
    return ef.build_from_config(config)  # raises the same error load would raise

Try / catch

try:
    col = client.get_collection("docs")
except ValueError as e:
    if "Could not build embedding function" in str(e):
        # the suffix contains the underlying validation error — fix that param
        logger.error("ef build failed: %s", e)
    raise

Prevention

When it happens

Trigger: get_collection() deserializing a config whose parameter names/types changed across versions; an ONNX/local-model EF whose downloaded model files are missing on this machine; an OpenAI-style EF whose stored config omits a required field; config produced by a newer chromadb with fields this version rejects.

Common situations: Moving a persist directory or workspace between machines (missing model cache); upgrading chromadb on only one side; collections created with newer EF config schema.

Related errors


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