{"record":{"id":"4522ae37b66d54b9","repo":"chroma-core/chroma","slug":"embedding-function-name-not-found-in-config-ef-c","errorCode":null,"errorMessage":"Embedding function name not found in config: {ef_config}","messagePattern":"Embedding function name not found in config: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/api/collection_configuration.py","lineNumber":92,"sourceCode":"        hnsw_config = cast(HNSWConfiguration, config_json_map[\"hnsw\"])\n    if config_json_map.get(\"spann\") is not None:\n        spann_config = cast(SpannConfiguration, config_json_map[\"spann\"])\n\n    # Process embedding function configuration\n    if config_json_map.get(\"embedding_function\") is not None:\n        ef_config = config_json_map[\"embedding_function\"]\n        if ef_config[\"type\"] == \"legacy\":\n            warnings.warn(\n                \"legacy embedding function config\",\n                DeprecationWarning,\n                stacklevel=2,\n            )\n            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","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/api/collection_configuration.py#L74-L110","documentation":"While deserializing a collection's persisted configuration, the embedding_function block exists and its 'type' is not 'legacy', but the block has no 'name' key — the lookup ef_config['name'] raises KeyError, re-raised as this ValueError. The stored embedding-function config is structurally incomplete, so Chroma cannot tell which registered function to rebuild.","triggerScenarios":"Stored config like {\"embedding_function\": {\"type\": \"known\"}} without \"name\"; collection metadata corrupted by manual edits or a partial migration; a test fixture writing hand-crafted configuration JSON.","commonSituations":"Upgrades that wrote incomplete configs; direct SQLite manipulation; importing data from another Chroma instance with a schema mismatch.","solutions":["Recreate the collection with a proper embedding function so a complete config is persisted.","Repair the stored configuration JSON to include the correct name field.","If the collection data matters, export the documents/embeddings first, then recreate and reimport."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"def ef_config_complete(config_json: dict) -> bool:\n    ef = config_json.get(\"embedding_function\")\n    return ef is None or ef.get(\"type\") == \"legacy\" or \"name\" in ef\n\nassert ef_config_complete({\"embedding_function\": {\"type\": \"known\", \"name\": \"onnx MiniLM-L6-v2\", \"config\": {}}})","typeGuard":null,"tryCatchPattern":"try:\n    col = client.get_collection(\"docs\")\nexcept ValueError as e:\n    if \"name not found in config\" in str(e):\n        raise RuntimeError(\"stored embedding-function config is incomplete; recreate the collection\") from e\n    raise","preventionTips":["Only write collection configuration through the official create/modify APIs.","Back up before migrating or editing persisted data.","After upgrades, smoke-test get_collection on a copy of production data."],"tags":["chroma","collection-configuration","embedding-function","deserialization"],"backgroundTag":"missing-config-field","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}