{"record":{"id":"325566e63fb834e7","repo":"chroma-core/chroma","slug":"embedding-function-must-be-callable-or-none","errorCode":null,"errorMessage":"embedding_function must be callable or None","messagePattern":"embedding_function must be callable or None","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/api/types.py","lineNumber":1733,"sourceCode":"        if v.startswith(\"#\") and v != \"#document\":\n            raise ValueError(\n                \"source_key cannot begin with '#'. \"\n                \"The only valid key starting with '#' is Key.DOCUMENT or '#document'.\"\n            )\n\n        return v  # type: ignore[no-any-return]\n\n    @field_validator(\"embedding_function\", mode=\"before\")\n    @classmethod\n    def validate_embedding_function_field(cls, v: Any) -> Any:\n        # Use the existing validate_embedding_function for proper validation\n        if v is None:\n            return v\n        if callable(v):\n            # Use the existing validation function\n            validate_embedding_function(v)\n            return v\n        raise ValueError(\"embedding_function must be callable or None\")\n\n\nclass SparseVectorIndexConfig(BaseModel):\n    \"\"\"Configuration for sparse vector index.\"\"\"\n\n    model_config = {\"arbitrary_types_allowed\": True}\n\n    _validate_extra_fields = _create_extra_fields_validator(\n        [\n            \"embedding_function\",\n            \"source_key\",\n            \"bm25\",\n            \"algorithm\",\n        ]\n    )\n\n    # TODO(Sanket): Change this to the appropriate sparse ef and use a default here.\n    embedding_function: Optional[Any] = None","sourceCodeStart":1715,"sourceCodeEnd":1751,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/api/types.py#L1715-L1751","documentation":"Error \"embedding_function must be callable or None\" thrown in chroma-core/chroma.","triggerScenarios":"Thrown at chromadb/api/types.py:1733 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}