chroma-core/chroma · error · ValueError
Invalid parameter name: {name}
Error message
Invalid parameter name: {name} What it means
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.
Source
Thrown at chromadb/api/configuration.py:164
pass
def get_parameters(self) -> List[ConfigurationParameter]:
"""Returns the parameters of the configuration."""
return list(self.parameter_map.values())
def get_parameter(self, name: str) -> ConfigurationParameter:
"""Returns the parameter with the given name, or except if it doesn't exist."""
if name not in self.parameter_map:
raise ValueError(
f"Invalid parameter name: {name} for configuration {self.__class__.__name__}"
)
param_value = cast(ConfigurationParameter, self.parameter_map.get(name))
return param_value
def set_parameter(self, name: str, value: Union[str, int, float, bool]) -> None:
"""Sets the parameter with the given name to the given value."""
if name not in self.definitions:
raise ValueError(f"Invalid parameter name: {name}")
definition = self.definitions[name]
parameter = self.parameter_map[name]
if definition.is_static:
raise StaticParameterError(f"Cannot set static parameter: {name}")
if not definition.validator(value):
raise ValueError(f"Invalid value for parameter {name}: {value}")
parameter.value = value
@override
def to_json_str(self) -> str:
"""Returns the JSON representation of the configuration."""
return json.dumps(self.to_json())
@classmethod
@override
def from_json_str(cls, json_str: str) -> Self:
"""Returns a configuration from the given JSON string."""
try:View on GitHub (pinned to aecdd12c8a)
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
Example fix
# before
cfg.set_parameter("hnsw:search_ef", 100) # legacy name -> error
# after
legacy_to_new = {"hnsw:search_ef": "ef_search"}
cfg.set_parameter("ef_search", 100) Defensive patterns
Strategy: validation
Validate before calling
def safe_set(cfg, name, value):
if name not in cfg.definitions:
raise KeyError(f"unknown parameter {name!r}; valid: {sorted(cfg.definitions)}")
cfg.set_parameter(name, value) Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Invalid parameter name: {parameter.name}
- Invalid parameter name: {name} for configuration {self.__cla
- Invalid value for parameter {name}: {value}
- Invalid configuration type: {parameter.value}
- Invalid parameter value: {parameter.value}
AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16).
Data as JSON: /api/errors/4f49a28629f5585a.
Report an issue: GitHub.