Comfy-Org/ComfyUI · error · ValueError

Unknown key(s) in transformer_options chroma_radiance_option

Error message

Unknown key(s) in transformer_options chroma_radiance_options: {', '.join(bad_keys)}

What it means

radiance_get_override_params merges user-supplied overrides from transformer_options['chroma_radiance_options'] into a copy of the model's ChromaRadianceParams. It first builds the set of valid keys from the dataclass fields; any override key not in that set is collected into bad_keys and raises ValueError listing the unknown names. This guards against silently ignoring typos in option names (e.g. 'patch_sze'), which would make users believe an option took effect.

Source

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

            # pass through the dynamic MLP blocks (the NeRF)
            for block in self.nerf_blocks:
                img_dct_tile = block(img_dct_tile, nerf_hidden_tile)

            output_tiles.append(img_dct_tile)

        # Concatenate the processed tiles along the patch dimension
        return torch.cat(output_tiles, dim=0)

    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)

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Read the error message: it lists exactly which keys are unknown; remove or correct them in chroma_radiance_options
  2. Check ChromaRadianceParams fields in comfy/ldm/chroma_radiance/model.py for the valid key set in your ComfyUI version
  3. Update the custom node that injects the options to match the current field names

Example fix

# before
transformer_options["chroma_radiance_options"] = {"tile_hight": 512}

# after
transformer_options["chroma_radiance_options"] = {"tile_height": 512}
Defensive patterns

Strategy: validation

Validate before calling

from dataclasses import fields
valid = {f.name for f in fields(type(model.params))}
bad = set(options) - valid
if bad:
    raise ValueError(f"Unknown chroma_radiance_options: {bad}; valid: {sorted(valid)}")

Type guard

def filter_valid_options(options: dict, param_cls) -> dict:
    valid = {f.name for f in dataclasses.fields(param_cls)}
    return {k: v for k, v in options.items() if k in valid}

Try / catch

try:
    model(x, t, context, transformer_options={"chroma_radiance_options": opts})
except ValueError as e:
    if "Unknown key" in str(e):
        bad = set(opts) - {f.name for f in dataclasses.fields(type(model.params))}
        opts = {k: v for k, v in opts.items() if k not in bad}
    else:
        raise

Prevention

When it happens

Trigger: Passing chroma_radiance_options in transformer_options with a misspelled or unsupported key, e.g. {'tile_hight': 512} or a key that only exists on Chroma but not ChromaRadianceParams. The merge happens every forward pass in _forward, so the error surfaces at the first sampling step.

Common situations: Custom nodes or hand-written patches injecting radiance tiling options; copying option snippets between ComfyUI versions where the params dataclass gained/renamed fields; stale custom node using pre-rename key names.

Related errors


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