chroma-core/chroma · error · ValueError
Multiple embedding functions provided. Please provide only o
Error message
Multiple embedding functions provided. Please provide only one. Embedding function conflict: {embedding_function.name()} vs {configuration_ef.name()} What it means
This ValueError from validate_embedding_function_conflict (on the create path) fires when an embedding function is passed BOTH as the embedding_function= argument AND inside the collection configuration, and the two are different (neither is the 'default' placeholder). Chroma refuses to guess which function owns the collection's embedding space, so it rejects the ambiguous request.
Source
Thrown at chromadb/api/collection_configuration.py:783
Validates that there are no conflicting embedding functions between function parameter
and collection configuration.
Args:
embedding_function: The embedding function provided as a parameter
configuration_ef: The embedding function from collection configuration
Returns:
bool: True if there is a conflict, False otherwise
"""
# If ef provided in function params and collection config, check if they are the same
# If not, there's a conflict
# ef is by default "default" if not provided, so ignore that case.
if embedding_function is not None and configuration_ef is not None:
if (
embedding_function.name() != "default"
and embedding_function.name() != configuration_ef.name()
):
raise ValueError(
f"Multiple embedding functions provided. Please provide only one. Embedding function conflict: {embedding_function.name()} vs {configuration_ef.name()}"
)
return None
# The reason to use the config on get, rather than build the ef is because
# if there is an issue with deserializing the config, an error shouldn't be raised
# at get time. CollectionCommon.py will raise an error at _embed time if there is an issue deserializing.
def validate_embedding_function_conflict_on_get(
embedding_function: Optional[EmbeddingFunction], # type: ignore
persisted_ef_config: Optional[Dict[str, Any]],
) -> None:
"""
Validates that there are no conflicting embedding functions between function parameter
and collection configuration.
"""
if persisted_ef_config is not None and embedding_function is not None:
if (View on GitHub (pinned to aecdd12c8a)
Solutions
- Provide the embedding function in exactly ONE place: either the configuration or the embedding_function argument, not both
- If both exist in your code path, drop the legacy embedding_function= kwarg and keep the configuration one
- Make sure the two are truly identical when a framework injects one for you
Example fix
// before
client.create_collection(
name='docs',
embedding_function=SentenceTransformerEmbeddingFunction(),
configuration=CollectionConfiguration(
embedding_function=OpenAIEmbeddingFunction(api_key=KEY)
),
) # ValueError: conflict
// after
client.create_collection(
name='docs',
configuration=CollectionConfiguration(
embedding_function=OpenAIEmbeddingFunction(api_key=KEY)
),
) Defensive patterns
Strategy: validation
Validate before calling
def embedding_functions_consistent(kwarg_ef, config_ef) -> bool:
if kwarg_ef is None or config_ef is None:
return True
return kwarg_ef.name() == 'default' or kwarg_ef.name() == config_ef.name()
assert embedding_functions_consistent(my_ef, cfg.get('embedding_function'))
client.create_collection(name='c', embedding_function=my_ef, configuration=cfg) Type guard
def embedding_functions_consistent(kwarg_ef, config_ef) -> bool:
if kwarg_ef is None or config_ef is None:
return True
return kwarg_ef.name() == 'default' or kwarg_ef.name() == config_ef.name() Try / catch
try:
client.create_collection(name='c', embedding_function=my_ef, configuration=cfg)
except ValueError as e:
if 'Multiple embedding functions provided' in str(e):
client.create_collection(name='c', configuration=cfg) # config wins, kwarg dropped
else:
raise Prevention
- Adopt one convention (config-based EF) and delete legacy embedding_function= usage
- Wrap collection creation in a helper that refuses both inputs
- In framework integrations (LangChain etc.), check whether the wrapper already injects an EF before adding yours
When it happens
Trigger: Calling client.create_collection(name='c', embedding_function=my_ef, configuration=CollectionConfiguration(embedding_function=other_ef)) where my_ef.name() != other_ef.name() and my_ef.name() != 'default'. Also triggered by wrappers (LangChain, LlamaIndex) that inject their own embedding_function while the user also supplies a configuration embedding function.
Common situations: Adopting the new collection configuration API while keeping the legacy embedding_function= kwarg out of habit; framework integrations passing both implicitly; copy-pasting configuration examples into code that already sets embedding_function.
Related errors
- An embedding function already exists in the collection confi
- Embedding function provided when already defined in the coll
- not a valid space: {space_value}
- Cannot update embedding function: incompatible types ({exist
- Invalid URL. Unrecognized protocol - {parsed.scheme}.
AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16).
Data as JSON: /api/errors/ea9fd1e1e1a60965.
Report an issue: GitHub.