{"record":{"id":"86080b53f9007428","repo":"chroma-core/chroma","slug":"model-must-be-provided-in-config","errorCode":null,"errorMessage":"model must be provided in config","messagePattern":"model must be provided in config","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/utils/embedding_functions/chroma_cloud_splade_embedding_function.py","lineNumber":153,"sourceCode":"\n            normalized_vectors.append(\n                normalize_sparse_vector(indices=indices, values=values, labels=labels)\n            )\n\n        return normalized_vectors\n\n    @staticmethod\n    def name() -> str:\n        return \"chroma-cloud-splade\"\n\n    @staticmethod\n    def build_from_config(\n        config: Dict[str, Any]\n    ) -> \"SparseEmbeddingFunction[Documents]\":\n        api_key_env_var = config.get(\"api_key_env_var\")\n        model = config.get(\"model\")\n        if model is None:\n            raise ValueError(\"model must be provided in config\")\n        if not api_key_env_var:\n            raise ValueError(\"api_key_env_var must be provided in config\")\n        return ChromaCloudSpladeEmbeddingFunction(\n            api_key_env_var=api_key_env_var,\n            model=ChromaCloudSpladeEmbeddingModel(model),\n            include_tokens=config.get(\"include_tokens\", False),\n        )\n\n    def get_config(self) -> Dict[str, Any]:\n        return {\n            \"api_key_env_var\": self.api_key_env_var,\n            \"model\": self.model.value,\n            \"include_tokens\": self.include_tokens,\n        }\n\n    def validate_config_update(\n        self, old_config: Dict[str, Any], new_config: Dict[str, Any]\n    ) -> None:","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/utils/embedding_functions/chroma_cloud_splade_embedding_function.py#L135-L171","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nef = ChromaCloudSpladeEmbeddingFunction.build_from_config(\n    {\"api_key_env_var\": \"CHROMA_API_KEY\"}  # ValueError: model must be provided\n)\n\n# after\nef = ChromaCloudSpladeEmbeddingFunction.build_from_config({\n    \"api_key_env_var\": \"CHROMA_API_KEY\",\n    \"model\": \"prithivida/Splade_PP_en_v1\",\n})","handlingStrategy":"validation","validationCode":"SPLADE_MODELS = {m.value for m in ChromaCloudSpladeEmbeddingModel}\nif config.get(\"model\") not in SPLADE_MODELS:\n    raise ValueError(f\"config['model'] must be one of {sorted(SPLADE_MODELS)}\")\nef = ChromaCloudSpladeEmbeddingFunction.build_from_config(config)","typeGuard":"def is_buildable_splade_config(config: dict) -> bool:\n    return config.get(\"model\") in {m.value for m in ChromaCloudSpladeEmbeddingModel} and bool(config.get(\"api_key_env_var\"))","tryCatchPattern":null,"preventionTips":["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."],"tags":["chroma-cloud","splade","config-validation","deserialization","embedding-function"],"backgroundTag":"config-validation-failed","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}