Comfy-Org/ComfyUI · critical · RuntimeError
Attempt to create ChromaRadiance object without setting oper
Error message
Attempt to create ChromaRadiance object without setting operations
What it means
ChromaRadiance subclasses Chroma but must be built through ComfyUI's operations layer (comfy.ops / quant backends) because its modules rely on an operations object for all Linear/Conv construction; a plain nn.Module instantiation with operations=None would crash later inside operations.Linear. The constructor therefore fails fast with a RuntimeError the moment operations is missing. Per repo policy, operations is never optional for this model.
Source
Thrown at comfy/ldm/chroma_radiance/model.py:51
nerf_max_freqs: int
# Setting nerf_tile_size to 0 disables tiling.
nerf_tile_size: int
# Currently one of linear (legacy) or conv.
nerf_final_head_type: str
# None means use the same dtype as the model.
nerf_embedder_dtype: Optional[torch.dtype]
use_x0: bool
# Use sequential txt_ids instead of zeros
use_sequential_txt_ids: bool
class ChromaRadiance(Chroma):
"""
Transformer model for flow matching on sequences.
"""
def __init__(self, image_model=None, final_layer=True, dtype=None, device=None, operations=None, **kwargs):
if operations is None:
raise RuntimeError("Attempt to create ChromaRadiance object without setting operations")
nn.Module.__init__(self)
self.dtype = dtype
params = ChromaRadianceParams(**kwargs)
self.params = params
self.patch_size = params.patch_size
self.in_channels = params.in_channels
self.out_channels = params.out_channels
if params.hidden_size % params.num_heads != 0:
raise ValueError(
f"Hidden size {params.hidden_size} must be divisible by num_heads {params.num_heads}"
)
pe_dim = params.hidden_size // params.num_heads
if sum(params.axes_dim) != pe_dim:
raise ValueError(f"Got {params.axes_dim} but expected positional dim {pe_dim}")
self.hidden_size = params.hidden_size
self.num_heads = params.num_heads
self.in_dim = params.in_dim
self.out_dim = params.out_dimView on GitHub (pinned to 1c6d8d45b3)
Solutions
- Pass an operations object, e.g. operations=comfy.ops.cast_to or the operations used by your model backend
- Prefer loading the model through ComfyUI's checkpoint loading / model detection so operations is injected automatically
- If writing a custom model wrapper, mirror how other ComfyUI models receive operations from comfy.model_management
Example fix
# before model = ChromaRadiance(**config) # RuntimeError # after import comfy.ops model = ChromaRadiance(dtype=dtype, device=device, operations=comfy.ops.disable_weight_init, **config)
Defensive patterns
Strategy: validation
Validate before calling
import comfy.ops
if operations is None:
operations = comfy.ops.disable_weight_init # or the appropriate backend ops
model = ChromaRadiance(dtype=dtype, device=device, operations=operations, **config) Type guard
def has_operations(operations) -> bool:
return operations is not None and all(hasattr(operations, a) for a in ("Linear", "Conv2d")) Prevention
- Construct ComfyUI models only through checkpoint loading / model detection
- Never call model __init__ without an operations object
When it happens
Trigger: Calling ChromaRadiance(...) directly with the default operations=None, e.g. ChromaRadiance(**config) from a test or custom loader. Normal creation goes through comfy.supported_models / model detection, which always supplies operations (e.g. comfy.ops.cast_to or a quant-aware operations class).
Common situations: Custom scripts or unit tests instantiating the model class bare; a custom node building ChromaRadiance itself instead of going through the model detection/loading path; copying example code that predates the operations requirement.
Related errors
- Hidden size {params.hidden_size} must be divisible by num_he
- Unsupported nerf_final_head_type {params.nerf_final_head_typ
- Unknown key(s) in transformer_options chroma_radiance_option
- Invalid value(s) in transformer_options chroma_radiance_opti
- Block type {block_type} not supported
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/31a3eb1a5dc85fc3.
Report an issue: GitHub.