{"record":{"id":"a735fafe38c6e339","repo":"chroma-core/chroma","slug":"unsupported-embedding-function-name","errorCode":null,"errorMessage":"Unsupported embedding function: {name}","messagePattern":"Unsupported embedding function: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/utils/embedding_functions/__init__.py","lineNumber":259,"sourceCode":"    return _register\n\n\n# Function to convert config to embedding function\ndef config_to_embedding_function(config: Dict[str, Any]) -> EmbeddingFunction:  # type: ignore\n    \"\"\"Convert a config dictionary to an embedding function.\n\n    Args:\n        config: The config dictionary.\n\n    Returns:\n        The embedding function.\n    \"\"\"\n    if \"name\" not in config:\n        raise ValueError(\"Config must contain a 'name' field.\")\n\n    name = config[\"name\"]\n    if name not in known_embedding_functions:\n        raise ValueError(f\"Unsupported embedding function: {name}\")\n\n    ef_config = config.get(\"config\", {})\n\n    if known_embedding_functions[name] is None:\n        raise ValueError(f\"Unsupported embedding function: {name}\")\n\n    validate_embedding_function_config_is_safe(name, ef_config)\n    return known_embedding_functions[name].build_from_config(ef_config)\n\n\n__all__ = [\n    \"EmbeddingFunction\",\n    \"DefaultEmbeddingFunction\",\n    \"CohereEmbeddingFunction\",\n    \"OpenAIEmbeddingFunction\",\n    \"BasetenEmbeddingFunction\",\n    \"CloudflareWorkersAIEmbeddingFunction\",\n    \"HuggingFaceEmbeddingFunction\",","sourceCodeStart":241,"sourceCodeEnd":277,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/utils/embedding_functions/__init__.py#L241-L277","documentation":"After confirming the config has a \"name\" key, config_to_embedding_function looks that name up in known_embedding_functions — the registry of built-ins (\"default\", \"openai\", \"cohere\", \"amazon_bedrock\", \"baseten\", ...) plus anything registered via register_embedding_function in the current process. An unknown name raises this ValueError. Matching is exact and case-sensitive.","triggerScenarios":"config_to_embedding_function({\"name\": \"OpenAI\"}) (wrong case), {\"name\": \"my_ef\"} where the custom class was never registered in this process, or a name that existed in an older chromadb version but was renamed/removed.","commonSituations":"Custom EF registered in the writer process but not in the reader/server/worker that deserializes the collection; case or underscore mismatches (\"sentence-transformer\" vs \"sentence_transformer\"); configs produced against a different chromadb version.","solutions":["Print the exact valid keys: from chromadb.utils.embedding_functions import known_embedding_functions; print(sorted(known_embedding_functions)) and use one verbatim.","If the name refers to a custom function, import and register it (register_embedding_function(MyEF)) before calling config_to_embedding_function.","Check casing, hyphens vs underscores, and version drift against the registry keys in the chromadb you actually run."],"exampleFix":"# before: ValueError \"Unsupported embedding function: my_ef\"\nef = config_to_embedding_function({\"name\": \"my_ef\", \"config\": {}})\n\n# after: register the custom class in this process first\nfrom chromadb.utils.embedding_functions import register_embedding_function\nregister_embedding_function(MyEF)\nef = config_to_embedding_function({\"name\": \"my_ef\", \"config\": {}})","handlingStrategy":"validation","validationCode":"from chromadb.utils.embedding_functions import known_embedding_functions\n\ndef require_known_name(name: str) -> str:\n    if name not in known_embedding_functions:\n        available = \", \".join(sorted(known_embedding_functions))\n        raise ValueError(f\"Unknown EF '{name}'. Available: {available}\")\n    return name\n\nef = config_to_embedding_function({\"name\": require_known_name(cfg[\"name\"]), \"config\": cfg.get(\"config\", {})})","typeGuard":"from chromadb.utils.embedding_functions import known_embedding_functions\n\ndef is_registered_ef_name(name: object) -> bool:\n    return isinstance(name, str) and name in known_embedding_functions and known_embedding_functions[name] is not None","tryCatchPattern":"try:\n    ef = config_to_embedding_function(cfg)\nexcept ValueError as e:\n    if \"Unsupported embedding function\" in str(e):\n        register_embedding_function(MyEF)  # custom EFs must be registered in this process first\n        ef = config_to_embedding_function(cfg)\n    else:\n        raise","preventionTips":["Import and register custom embedding function classes in every process that deserializes collections.","Log sorted(known_embedding_functions) at startup so name mismatches are visible immediately.","Treat EF names as versioned API: pin chromadb and re-verify names after upgrades."],"tags":["python","embedding-functions","registry","config","unknown-name","chromadb"],"backgroundTag":"unknown-provider-name","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}