{"record":{"id":"d9a9adeb88f0234e","repo":"chroma-core/chroma","slug":"could-not-build-embedding-function-ef-config-nam","errorCode":null,"errorMessage":"Could not build embedding function {ef_config['name']} from config {ef_config['config']}: {e}","messagePattern":"Could not build embedding function (.+?) from config (.+?): (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/api/collection_configuration.py","lineNumber":105,"sourceCode":"            ef = None\n        else:\n            try:\n                ef_name = ef_config[\"name\"]\n            except KeyError:\n                raise ValueError(\n                    f\"Embedding function name not found in config: {ef_config}\"\n                )\n            try:\n                ef = known_embedding_functions[ef_name]\n            except KeyError:\n                raise ValueError(\n                    f\"Embedding function {ef_name} not found. Add @register_embedding_function decorator to the class definition.\"\n                )\n            try:\n                validate_embedding_function_config_is_safe(ef_name, ef_config[\"config\"])\n                ef = ef.build_from_config(ef_config[\"config\"])  # type: ignore\n            except Exception as e:\n                raise ValueError(\n                    f\"Could not build embedding function {ef_config['name']} from config {ef_config['config']}: {e}\"\n                )\n    else:\n        ef = None\n\n    return CollectionConfiguration(\n        hnsw=hnsw_config,\n        spann=spann_config,\n        embedding_function=ef,  # type: ignore\n    )\n\n\ndef collection_configuration_to_json_str(config: CollectionConfiguration) -> str:\n    return json.dumps(collection_configuration_to_json(config))\n\n\ndef collection_configuration_to_json(config: CollectionConfiguration) -> Dict[str, Any]:\n    if isinstance(config, dict):","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/api/collection_configuration.py#L87-L123","documentation":"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.","triggerScenarios":"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.","commonSituations":"Moving a persist directory or workspace between machines (missing model cache); upgrading chromadb on only one side; collections created with newer EF config schema.","solutions":["Read the {e} suffix of the message — it is the underlying validation/build error and names the offending parameter.","Align chromadb versions between the process that created the collection and the one loading it.","For local-model EFs (e.g. ONNX MiniLM), ensure the model files/cache are present on the loading machine.","Recreate the collection with a valid, current embedding function config and re-embed if necessary."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from chromadb.utils.embedding_functions import known_embedding_functions\nfrom chromadb.utils.embedding_functions.config_validation import (\n    validate_embedding_function_config_is_safe,\n)\n\ndef dry_run_build(name: str, config: dict):\n    ef = known_embedding_functions[name]\n    validate_embedding_function_config_is_safe(name, config)\n    return ef.build_from_config(config)  # raises the same error load would raise","typeGuard":null,"tryCatchPattern":"try:\n    col = client.get_collection(\"docs\")\nexcept ValueError as e:\n    if \"Could not build embedding function\" in str(e):\n        # the suffix contains the underlying validation error — fix that param\n        logger.error(\"ef build failed: %s\", e)\n    raise","preventionTips":["Read the appended cause in the message; it names the exact invalid parameter.","Keep the chromadb version identical on writer and reader.","For local-model EFs, ensure model caches exist on every machine that opens the collection."],"tags":["chroma","embedding-function","config-validation","deserialization","version-mismatch"],"backgroundTag":"config-validation-failed","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}