chroma-core/chroma · error · ValueError

Invalid parameter value: {parameter.value}

Error message

Invalid parameter value: {parameter.value}

What it means

Raised in ConfigurationInternal.__init__ (chromadb/api/configuration.py:117) when a parameter value's type does not match type(definition.default_value). The constructor enforces exact declared types (str/int/float/bool or a ConfigurationInternal subclass), so a JSON round-trip that turned a number into a string, or a float where an int is declared, is rejected before the validator even runs.

Source

Thrown at chromadb/api/configuration.py:117

        """Initializes a new instance of the Configuration class. Respecting defaults and
        validators."""
        self.parameter_map = {}
        if parameters is not None:
            for parameter in parameters:
                if parameter.name not in self.definitions:
                    raise ValueError(f"Invalid parameter name: {parameter.name}")

                definition = self.definitions[parameter.name]
                # Handle the case where we have a recursive configuration definition
                if isinstance(parameter.value, dict):
                    child_type = globals().get(parameter.value.get("_type", None))
                    if child_type is None:
                        raise ValueError(
                            f"Invalid configuration type: {parameter.value}"
                        )
                    parameter.value = child_type.from_json(parameter.value)
                if not isinstance(parameter.value, type(definition.default_value)):
                    raise ValueError(f"Invalid parameter value: {parameter.value}")

                parameter_validator = definition.validator
                if not parameter_validator(parameter.value):
                    raise ValueError(f"Invalid parameter value: {parameter.value}")
                self.parameter_map[parameter.name] = parameter
        # Apply the defaults for any missing parameters
        for name, definition in self.definitions.items():
            if name not in self.parameter_map:
                self.parameter_map[name] = ConfigurationParameter(
                    name=name, value=definition.default_value
                )

        self.configuration_validator()

    def __repr__(self) -> str:
        return f"Configuration({self.parameter_map.values()})"

    def __eq__(self, __value: object) -> bool:

View on GitHub (pinned to aecdd12c8a)

Solutions

  1. Coerce the value to the declared type before constructing: int(value), float(value), str(value), or bool parsing for "true"/"false"
  2. Check the expected type from the definition: type(Cls.definitions[name].default_value)
  3. Regenerate the JSON with the same chromadb version that consumes it

Example fix

# before
params = [ConfigurationParameter(name="sync_threshold", value="1000")]
cfg = HNSWConfigurationInternal(parameters=params)   # str vs int -> error
# after
params = [ConfigurationParameter(name="sync_threshold", value=int("1000"))]
cfg = HNSWConfigurationInternal(parameters=params)
Defensive patterns

Strategy: validation

Validate before calling

def coerce_like_default(cls, name, value):
    default = cls.definitions[name].default_value
    target = type(default)
    if isinstance(value, ConfigurationInternal) or isinstance(value, target):
        return value
    return target(value)  # int("100"), float("0.5"), etc.

params = [ConfigurationParameter(n, coerce_like_default(Cls, n, v))
          for n, v in raw.items()]

Prevention

When it happens

Trigger: Passing "100" (string) for an int-declared parameter like sync_threshold; passing 0.5 for an int parameter; passing 1 for a bool-declared parameter (isinstance(1, bool) is False); JSON deserialization where numbers arrive as strings from env vars or form input.

Common situations: Reading settings from environment variables or YAML without coercion; configs edited by hand where numbers are quoted; cross-language producers (JSON from services that stringify numerics).

Related errors


AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16). Data as JSON: /api/errors/7830b099eafc0a12. Report an issue: GitHub.