{"record":{"id":"a88b33253b3c29be","repo":"chroma-core/chroma","slug":"updating-key-is-not-supported-for-name-a88b33","errorCode":null,"errorMessage":"Updating '{key}' is not supported for {NAME}","messagePattern":"Updating '(.+?)' is not supported for (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/utils/embedding_functions/chroma_bm25_embedding_function.py","lineNumber":174,"sourceCode":"        if self.stopwords is not None:\n            config[\"stopwords\"] = list(self.stopwords)\n\n        return config\n\n    def validate_config_update(\n        self, old_config: Dict[str, Any], new_config: Dict[str, Any]\n    ) -> None:\n        mutable_keys = {\n            \"k\",\n            \"b\",\n            \"avg_doc_length\",\n            \"token_max_length\",\n            \"stopwords\",\n            \"include_tokens\",\n        }\n        for key in new_config:\n            if key not in mutable_keys:\n                raise ValueError(f\"Updating '{key}' is not supported for {NAME}\")\n\n    @staticmethod\n    def validate_config(config: Dict[str, Any]) -> None:\n        validate_config_schema(config, NAME)\n","sourceCodeStart":156,"sourceCodeEnd":179,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/utils/embedding_functions/chroma_bm25_embedding_function.py#L156-L179","documentation":"ChromaBm25EmbeddingFunction.validate_config_update rejects any embedding-function config update that contains a key outside the mutable set {k, b, avg_doc_length, token_max_length, stopwords, include_tokens}. Chroma enforces this because the BM25 sparse embedding function only supports live-tuning those six parameters; changing any other key would silently alter the function identity. The offender key name and the function name 'chroma_bm25' are interpolated into the message.","triggerScenarios":"Calling the EF config-update flow (e.g. collection.modify / embedding_function update with new_config) where new_config contains any key other than k, b, avg_doc_length, token_max_length, stopwords, include_tokens. Example: passing {\"stop_words\": [...]} (typo of \"stopwords\") or an extra key like \"name\".","commonSituations":"Persisted BM25 configs written by an older chromadb version that carried extra keys; hand-built config dicts with misspelled keys (stop_words vs stopwords); attempting to switch a collection from BM25 to another function by editing its config instead of recreating the collection.","solutions":["Remove the offending key named in the message from the update dict; only the six mutable keys are accepted.","Fix key spelling: the mutable keys are exactly k, b, avg_doc_length, token_max_length, stopwords, include_tokens.","If you truly need to change the embedding function identity, create a new collection with the desired function and re-ingest.","Validate against ChromaBm25Config (TypedDict) or validate_config_schema(config, 'chroma_bm25') before submitting."],"exampleFix":"# before\nnew_config = {\"k\": 1.5, \"stop_words\": [\"the\"]}  # ValueError: Updating 'stop_words' is not supported\n\n# after\nnew_config = {\"k\": 1.5, \"stopwords\": [\"the\"]}  # only k, b, avg_doc_length, token_max_length, stopwords, include_tokens","handlingStrategy":"validation","validationCode":"BM25_MUTABLE = {\"k\", \"b\", \"avg_doc_length\", \"token_max_length\", \"stopwords\", \"include_tokens\"}\ninvalid = set(new_config) - BM25_MUTABLE\nif invalid:\n    raise KeyError(f\"chroma_bm25 does not support updating: {sorted(invalid)}\")","typeGuard":"def is_valid_bm25_update(new_config: dict) -> bool:\n    return set(new_config) <= {\"k\", \"b\", \"avg_doc_length\", \"token_max_length\", \"stopwords\", \"include_tokens\"}","tryCatchPattern":"try:\n    ef.validate_config_update(old_config, new_config)\nexcept ValueError as e:\n    # strip the offending key named in the message and retry, or abort\n    raise","preventionTips":["Derive update dicts from the TypedDict ChromaBm25Config so only valid keys exist.","Never paste full get_config() output into an update; build a minimal delta dict.","Run validate_config_update in a unit test for every config your app writes."],"tags":["bm25","chroma","config-validation","embedding-function","immutable-config"],"backgroundTag":"config-validation-failed","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}