{"record":{"id":"6cae5170e690f1d2","repo":"Comfy-Org/ComfyUI","slug":"krea2-expects-conditioning-with-self-txtlayers-x","errorCode":null,"errorMessage":"Krea2 expects conditioning with {self.txtlayers}x{self.txtdim}={self.txtlayers * self.txtdim} features (a {self.txtlayers}-layer Qwen3-VL stack) but got {fused}. Load the text encoder with CLIPLoader type 'krea2'.","messagePattern":"Krea2 expects conditioning with (.+?)x(.+?)=(.+?) features \\(a (.+?)-layer Qwen3-VL stack\\) but got (.+?)\\. Load the text encoder with CLIPLoader type 'krea2'\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy/ldm/krea2/model.py","lineNumber":386,"sourceCode":"        for i, block in enumerate(self.blocks):\n            transformer_options[\"block_index\"] = i\n            combined = block(combined, tvec, freqs, None, timestep_zero_index=timestep_zero_index, transformer_options=transformer_options)\n\n        final = self.last(combined, t)\n        del combined\n        out = final[:, txtlen:txtlen + img_tokens, :]\n        out = rearrange(out, \"b (h w) (c ph pw) -> b c (h ph) (w pw)\",\n                        h=h_, w=w_, ph=patch, pw=patch, c=self.channels)\n        out = out[:, :, :h_orig, :w_orig]  # crop padding back off\n        if temporal:\n            out = out.reshape(b5, t5, self.channels, h_orig, w_orig).movedim(1, 2)\n        return out\n\n    def _unpack_context(self, context):\n        # context: (B, seq, txtlayers*txtdim) -> (B, seq, txtlayers, txtdim).\n        b, seq, fused = context.shape\n        if fused != self.txtlayers * self.txtdim:\n            raise ValueError(\n                f\"Krea2 expects conditioning with {self.txtlayers}x{self.txtdim}={self.txtlayers * self.txtdim} \"\n                f\"features (a {self.txtlayers}-layer Qwen3-VL stack) but got {fused}. \"\n                f\"Load the text encoder with CLIPLoader type 'krea2'.\"\n            )\n        return context.reshape(b, seq, self.txtlayers, self.txtdim)\n","sourceCodeStart":368,"sourceCodeEnd":392,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/ldm/krea2/model.py#L368-L392","documentation":"Krea2's diffusion model consumes fused conditioning of shape (B, seq, txtlayers*txtdim) built from a stack of Qwen3-VL hidden layers. This error means the last conditioning dimension does not equal that product, i.e. the conditioning came from a different text encoder setup than the 'krea2' CLIPLoader type.","triggerScenarios":"Feeding conditioning from a standard single-layer CLIP/T5 text encoder output (features = encoder dim, not txtlayers*txtdim), or connecting a Krea2 UNet with a generic CLIPLoader instead of type 'krea2'.","commonSituations":"Wiring the Krea2 model node to a default text encoding path, using cached conditioning from another model, or loading the text encoder with the wrong loader type.","solutions":["Load the text encoder with CLIPLoader type 'krea2' so it emits the multi-layer Qwen3-VL fused features","Re-encode all prompts with the krea2 encoder after switching; do not reuse conditioning cached from another encoder","Verify context.shape[-1] equals the model's txtlayers*txtdim before sampling"],"exampleFix":"# before\nclip = CLIPLoader(\"qwen3-vl.safetensors\", type=\"stable_diffusion\")\n# after\nclip = CLIPLoader(\"qwen3-vl.safetensors\", type=\"krea2\")","handlingStrategy":"validation","validationCode":"expected = model.txtlayers * model.txtdim\nassert conditioning.shape[-1] == expected, (conditioning.shape, expected)","typeGuard":"def is_krea2_conditioning(cond: torch.Tensor, model) -> bool:\n    return cond.dim() == 3 and cond.shape[-1] == model.txtlayers * model.txtdim","tryCatchPattern":null,"preventionTips":["Always pair Krea2 UNets with CLIPLoader type 'krea2'","Re-encode prompts after changing text encoder type; never reuse cached conditioning"],"tags":["krea2","text-encoder","conditioning","model-mismatch"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}