{"record":{"id":"4f49a28629f5585a","repo":"chroma-core/chroma","slug":"invalid-parameter-name-name","errorCode":null,"errorMessage":"Invalid parameter name: {name}","messagePattern":"Invalid parameter name: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/api/configuration.py","lineNumber":164,"sourceCode":"        pass\n\n    def get_parameters(self) -> List[ConfigurationParameter]:\n        \"\"\"Returns the parameters of the configuration.\"\"\"\n        return list(self.parameter_map.values())\n\n    def get_parameter(self, name: str) -> ConfigurationParameter:\n        \"\"\"Returns the parameter with the given name, or except if it doesn't exist.\"\"\"\n        if name not in self.parameter_map:\n            raise ValueError(\n                f\"Invalid parameter name: {name} for configuration {self.__class__.__name__}\"\n            )\n        param_value = cast(ConfigurationParameter, self.parameter_map.get(name))\n        return param_value\n\n    def set_parameter(self, name: str, value: Union[str, int, float, bool]) -> None:\n        \"\"\"Sets the parameter with the given name to the given value.\"\"\"\n        if name not in self.definitions:\n            raise ValueError(f\"Invalid parameter name: {name}\")\n        definition = self.definitions[name]\n        parameter = self.parameter_map[name]\n        if definition.is_static:\n            raise StaticParameterError(f\"Cannot set static parameter: {name}\")\n        if not definition.validator(value):\n            raise ValueError(f\"Invalid value for parameter {name}: {value}\")\n        parameter.value = value\n\n    @override\n    def to_json_str(self) -> str:\n        \"\"\"Returns the JSON representation of the configuration.\"\"\"\n        return json.dumps(self.to_json())\n\n    @classmethod\n    @override\n    def from_json_str(cls, json_str: str) -> Self:\n        \"\"\"Returns a configuration from the given JSON string.\"\"\"\n        try:","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/api/configuration.py#L146-L182","documentation":"ConfigurationInternal.set_parameter (chromadb/api/configuration.py:164) raises this ValueError when the name is not in the class's definitions dict. Unlike get_parameter (which checks the populated parameter_map), the setter checks definitions because only declared parameters can ever be set - an unknown name cannot be set even as a new entry.","triggerScenarios":"cfg.set_parameter(\"hnsw:space\", \"cosine\") using the legacy prefixed key; set_parameter(\"ef\", ...) where the declared name is \"ef_search\"; setting a parameter that exists on a different configuration class.","commonSituations":"Scripts migrating old metadata keys directly onto the new configuration object; typos or casing errors in dynamic loops that set parameters from a dict of user input.","solutions":["Check membership first: `if name not in cfg.definitions:` skip or log","Map legacy names to new names using the old_to_new table in from_legacy_params before setting","Prefer constructing a new configuration object over mutating one field at a time"],"exampleFix":"# before\ncfg.set_parameter(\"hnsw:search_ef\", 100)   # legacy name -> error\n# after\nlegacy_to_new = {\"hnsw:search_ef\": \"ef_search\"}\ncfg.set_parameter(\"ef_search\", 100)","handlingStrategy":"validation","validationCode":"def safe_set(cfg, name, value):\n    if name not in cfg.definitions:\n        raise KeyError(f\"unknown parameter {name!r}; valid: {sorted(cfg.definitions)}\")\n    cfg.set_parameter(name, value)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check `name in cfg.definitions` before every set_parameter call","Map legacy hnsw: keys to new names using the from_legacy_params mapping","Prefer rebuilding a configuration object over dynamic field mutation"],"tags":["chromadb","configuration","parameter-names","mutation"],"backgroundTag":"configuration-validation-failed","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}