{"record":{"id":"61ae911aa6695f94","repo":"Comfy-Org/ComfyUI","slug":"invalid-value-s-in-transformer-options-chroma-rad","errorCode":null,"errorMessage":"Invalid value(s) in transformer_options chroma_radiance_options: {', '.join(bad_keys)}","messagePattern":"Invalid value\\(s\\) in transformer_options chroma_radiance_options: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy/ldm/chroma_radiance/model.py","lineNumber":282,"sourceCode":"\n    def radiance_get_override_params(self, overrides: dict) -> ChromaRadianceParams:\n        params = self.params\n        if not overrides:\n            return params\n        params_dict = {k: getattr(params, k) for k in params.__dataclass_fields__}\n        nullable_keys = frozenset((\"nerf_embedder_dtype\",))\n        bad_keys = tuple(k for k in overrides if k not in params_dict)\n        if bad_keys:\n            e = f\"Unknown key(s) in transformer_options chroma_radiance_options: {', '.join(bad_keys)}\"\n            raise ValueError(e)\n        bad_keys = tuple(\n            k\n            for k, v in overrides.items()\n            if not isinstance(v, type(getattr(params, k))) and (v is not None or k not in nullable_keys)\n        )\n        if bad_keys:\n            e = f\"Invalid value(s) in transformer_options chroma_radiance_options: {', '.join(bad_keys)}\"\n            raise ValueError(e)\n        # At this point it's all valid keys and values so we can merge with the existing params.\n        params_dict |= overrides\n        return params.__class__(**params_dict)\n\n    def _apply_x0_residual(self, predicted, noisy, timesteps):\n\n        # non zero during training to prevent 0 div\n        eps = 0.0\n        return (noisy - predicted) / (timesteps.view(-1,1,1,1) + eps)\n\n    def _forward(\n        self,\n        x: Tensor,\n        timestep: Tensor,\n        context: Tensor,\n        guidance: Optional[Tensor],\n        control: Optional[dict]=None,\n        transformer_options: dict={},","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/ldm/chroma_radiance/model.py#L264-L300","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Cast each option to the field's native type before injecting: int() for sizes, bool() for flags","For nerf_embedder_dtype pass a torch.dtype (e.g. torch.bfloat16) or None, never a string","Validate the options dict against ChromaRadianceParams.__annotations__ in your node before sampling"],"exampleFix":"# before\nopts = {\"tile_height\": str(widget_value)}  # str into int field -> raises\n\n# after\nopts = {\"tile_height\": int(widget_value)}","handlingStrategy":"validation","validationCode":"def coerce_options(options: dict, params):\n    out = {}\n    for k, v in options.items():\n        t = type(getattr(params, k))\n        out[k] = v if isinstance(v, t) else t(v) if v is not None or k == \"nerf_embedder_dtype\" else None\n    return out","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Cast workflow-widget strings to the param's native type before injecting","Pass torch.dtype objects (or None) for nerf_embedder_dtype, never strings"],"tags":["chroma-radiance","transformer-options","type-validation","custom-nodes"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}