Comfy-Org/ComfyUI · error · ValueError

Invalid value(s) in transformer_options chroma_radiance_opti

Error message

Invalid value(s) in transformer_options chroma_radiance_options: {', '.join(bad_keys)}

What it means

The second validation stage of radiance_get_override_params: after key names are confirmed valid, each override value's type is compared against the type of the current param value (isinstance(v, type(current))). Values whose type does not match are reported as 'Invalid value(s)'. Only nerf_embedder_dtype may be None (nullable_keys); every other option must match the existing field's exact type - an int option needs an int, a str option a str, and bool options reject 0/1.

Source

Thrown at comfy/ldm/chroma_radiance/model.py:282

    def radiance_get_override_params(self, overrides: dict) -> ChromaRadianceParams:
        params = self.params
        if not overrides:
            return params
        params_dict = {k: getattr(params, k) for k in params.__dataclass_fields__}
        nullable_keys = frozenset(("nerf_embedder_dtype",))
        bad_keys = tuple(k for k in overrides if k not in params_dict)
        if bad_keys:
            e = f"Unknown key(s) in transformer_options chroma_radiance_options: {', '.join(bad_keys)}"
            raise ValueError(e)
        bad_keys = tuple(
            k
            for k, v in overrides.items()
            if not isinstance(v, type(getattr(params, k))) and (v is not None or k not in nullable_keys)
        )
        if bad_keys:
            e = f"Invalid value(s) in transformer_options chroma_radiance_options: {', '.join(bad_keys)}"
            raise ValueError(e)
        # At this point it's all valid keys and values so we can merge with the existing params.
        params_dict |= overrides
        return params.__class__(**params_dict)

    def _apply_x0_residual(self, predicted, noisy, timesteps):

        # non zero during training to prevent 0 div
        eps = 0.0
        return (noisy - predicted) / (timesteps.view(-1,1,1,1) + eps)

    def _forward(
        self,
        x: Tensor,
        timestep: Tensor,
        context: Tensor,
        guidance: Optional[Tensor],
        control: Optional[dict]=None,
        transformer_options: dict={},

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Cast each option to the field's native type before injecting: int() for sizes, bool() for flags
  2. For nerf_embedder_dtype pass a torch.dtype (e.g. torch.bfloat16) or None, never a string
  3. Validate the options dict against ChromaRadianceParams.__annotations__ in your node before sampling

Example fix

# before
opts = {"tile_height": str(widget_value)}  # str into int field -> raises

# after
opts = {"tile_height": int(widget_value)}
Defensive patterns

Strategy: validation

Validate before calling

def coerce_options(options: dict, params):
    out = {}
    for k, v in options.items():
        t = type(getattr(params, k))
        out[k] = v if isinstance(v, t) else t(v) if v is not None or k == "nerf_embedder_dtype" else None
    return out

Prevention

When it happens

Trigger: Passing chroma_radiance_options like {'tile_height': '512'} (str for an int field), {'use_x0': 1} (int for a bool field), or {'nerf_embedder_dtype': 'bf16'} (str where torch.dtype/None is expected). Note that bool is a subclass of int in Python, so an int field also accepts True/False, but a bool field rejects plain ints.

Common situations: Building option dicts from user-facing strings (workflow JSON widgets) without casting; JSON round-tripping converting tuples to lists; passing dtype names as strings instead of torch.dtype objects.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/61ae911aa6695f94. Report an issue: GitHub.