chroma-core/chroma · error · ValueError
model must be provided in config
Error message
model must be provided in config
What it means
build_from_config (used when Chroma rehydrates an embedding function from its persisted config) does config.get("model") and raises ValueError when it is None. The model is mandatory because it becomes the ChromaCloudSpladeEmbeddingModel enum driving the x-chroma-embedding-model header; without it the EF cannot be rebuilt.
Source
Thrown at chromadb/utils/embedding_functions/chroma_cloud_splade_embedding_function.py:153
normalized_vectors.append(
normalize_sparse_vector(indices=indices, values=values, labels=labels)
)
return normalized_vectors
@staticmethod
def name() -> str:
return "chroma-cloud-splade"
@staticmethod
def build_from_config(
config: Dict[str, Any]
) -> "SparseEmbeddingFunction[Documents]":
api_key_env_var = config.get("api_key_env_var")
model = config.get("model")
if model is None:
raise ValueError("model must be provided in config")
if not api_key_env_var:
raise ValueError("api_key_env_var must be provided in config")
return ChromaCloudSpladeEmbeddingFunction(
api_key_env_var=api_key_env_var,
model=ChromaCloudSpladeEmbeddingModel(model),
include_tokens=config.get("include_tokens", False),
)
def get_config(self) -> Dict[str, Any]:
return {
"api_key_env_var": self.api_key_env_var,
"model": self.model.value,
"include_tokens": self.include_tokens,
}
def validate_config_update(
self, old_config: Dict[str, Any], new_config: Dict[str, Any]
) -> None:View on GitHub (pinned to aecdd12c8a)
Solutions
- Add "model": "prithivida/Splade_PP_en_v1" (the SPLADE_PP_EN_V1 enum value) to the config dict.
- Prefer round-tripping the dict produced by get_config() rather than writing configs by hand.
- If the collection's persisted config lacks the key, recreate the collection with a fresh ChromaCloudSpladeEmbeddingFunction and re-ingest.
Example fix
# before
ef = ChromaCloudSpladeEmbeddingFunction.build_from_config(
{"api_key_env_var": "CHROMA_API_KEY"} # ValueError: model must be provided
)
# after
ef = ChromaCloudSpladeEmbeddingFunction.build_from_config({
"api_key_env_var": "CHROMA_API_KEY",
"model": "prithivida/Splade_PP_en_v1",
}) Defensive patterns
Strategy: validation
Validate before calling
SPLADE_MODELS = {m.value for m in ChromaCloudSpladeEmbeddingModel}
if config.get("model") not in SPLADE_MODELS:
raise ValueError(f"config['model'] must be one of {sorted(SPLADE_MODELS)}")
ef = ChromaCloudSpladeEmbeddingFunction.build_from_config(config) Type guard
def is_buildable_splade_config(config: dict) -> bool:
return config.get("model") in {m.value for m in ChromaCloudSpladeEmbeddingModel} and bool(config.get("api_key_env_var")) Prevention
- Always round-trip configs from get_config() instead of hand-writing them.
- Unit-test build_from_config against every config your app persists.
- Store configs as produced by the same chromadb version that will rebuild them.
When it happens
Trigger: Calling ChromaCloudSpladeEmbeddingFunction.build_from_config(config) with a config dict lacking a 'model' key — hand-crafted configs, configs from older chromadb versions that did not persist 'model', or tampered collection metadata during get_collection rehydration.
Common situations: Collections created before 'model' was persisted; manually edited/stripped config dicts; partial configs copy-pasted into build_from_config instead of using get_config() output.
Related errors
- api_key_env_var must be provided in config
- Could not build embedding function {ef_config['name']} from
- The model cannot be changed after the embedding function has
- The task cannot be changed after the embedding function has
- The instructions cannot be changed after the embedding funct
AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16).
Data as JSON: /api/errors/86080b53f9007428.
Report an issue: GitHub.