{"record":{"id":"31a3eb1a5dc85fc3","repo":"Comfy-Org/ComfyUI","slug":"attempt-to-create-chromaradiance-object-without-se","errorCode":null,"errorMessage":"Attempt to create ChromaRadiance object without setting operations","messagePattern":"Attempt to create ChromaRadiance object without setting operations","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"comfy/ldm/chroma_radiance/model.py","lineNumber":51,"sourceCode":"    nerf_max_freqs: int\n    # Setting nerf_tile_size to 0 disables tiling.\n    nerf_tile_size: int\n    # Currently one of linear (legacy) or conv.\n    nerf_final_head_type: str\n    # None means use the same dtype as the model.\n    nerf_embedder_dtype: Optional[torch.dtype]\n    use_x0: bool\n    # Use sequential txt_ids instead of zeros\n    use_sequential_txt_ids: bool\n\nclass ChromaRadiance(Chroma):\n    \"\"\"\n    Transformer model for flow matching on sequences.\n    \"\"\"\n\n    def __init__(self, image_model=None, final_layer=True, dtype=None, device=None, operations=None, **kwargs):\n        if operations is None:\n            raise RuntimeError(\"Attempt to create ChromaRadiance object without setting operations\")\n        nn.Module.__init__(self)\n        self.dtype = dtype\n        params = ChromaRadianceParams(**kwargs)\n        self.params = params\n        self.patch_size = params.patch_size\n        self.in_channels = params.in_channels\n        self.out_channels = params.out_channels\n        if params.hidden_size % params.num_heads != 0:\n            raise ValueError(\n                f\"Hidden size {params.hidden_size} must be divisible by num_heads {params.num_heads}\"\n            )\n        pe_dim = params.hidden_size // params.num_heads\n        if sum(params.axes_dim) != pe_dim:\n            raise ValueError(f\"Got {params.axes_dim} but expected positional dim {pe_dim}\")\n        self.hidden_size = params.hidden_size\n        self.num_heads = params.num_heads\n        self.in_dim = params.in_dim\n        self.out_dim = params.out_dim","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/ldm/chroma_radiance/model.py#L33-L69","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"# before\nmodel = ChromaRadiance(**config)  # RuntimeError\n\n# after\nimport comfy.ops\nmodel = ChromaRadiance(dtype=dtype, device=device, operations=comfy.ops.disable_weight_init, **config)","handlingStrategy":"validation","validationCode":"import comfy.ops\nif operations is None:\n    operations = comfy.ops.disable_weight_init  # or the appropriate backend ops\nmodel = ChromaRadiance(dtype=dtype, device=device, operations=operations, **config)","typeGuard":"def has_operations(operations) -> bool:\n    return operations is not None and all(hasattr(operations, a) for a in (\"Linear\", \"Conv2d\"))","tryCatchPattern":null,"preventionTips":["Construct ComfyUI models only through checkpoint loading / model detection","Never call model __init__ without an operations object"],"tags":["chroma-radiance","operations","model-init","custom-nodes"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}