{"record":{"id":"3aa9f43562bead51","repo":"invoke-ai/InvokeAI","slug":"at-least-one-krea-2-conditioning-is-required","errorCode":null,"errorMessage":"At least one Krea-2 conditioning is required.","messagePattern":"At least one Krea-2 conditioning is required\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/krea2_denoise.py","lineNumber":151,"sourceCode":"            antialias=False,\n        )\n        mask = mask.to(device=latents.device, dtype=latents.dtype)\n        return mask\n\n    def _load_text_conditioning(\n        self,\n        context: InvocationContext,\n        conditioning_field: Krea2ConditioningField | list[Krea2ConditioningField],\n        grid_height: int,\n        grid_width: int,\n        dtype: torch.dtype,\n        device: torch.device,\n    ) -> Krea2RegionalPromptingExtension:\n        conditioning_fields = (\n            [conditioning_field] if isinstance(conditioning_field, Krea2ConditioningField) else conditioning_field\n        )\n        if not conditioning_fields:\n            raise ValueError(\"At least one Krea-2 conditioning is required.\")\n\n        text_conditionings: list[Krea2TextConditioning] = []\n        for field in conditioning_fields:\n            cond_data = context.conditioning.load(field.conditioning_name)\n            assert len(cond_data.conditionings) == 1\n            conditioning = cond_data.conditionings[0]\n            assert isinstance(conditioning, Krea2ConditioningInfo)\n            conditioning = conditioning.to(dtype=dtype, device=device)\n            embeds = conditioning.prompt_embeds\n            if conditioning.prompt_embeds_mask is not None:\n                mask = conditioning.prompt_embeds_mask.to(device=device, dtype=torch.bool)\n                if mask.shape != embeds.shape[:2]:\n                    raise ValueError(\n                        f\"Krea-2 conditioning mask shape {tuple(mask.shape)} does not match \"\n                        f\"prompt embedding shape {tuple(embeds.shape[:2])}.\"\n                    )\n                valid_token_counts = mask.sum(dim=1)\n                if not torch.equal(valid_token_counts, valid_token_counts[:1].expand_as(valid_token_counts)):","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/krea2_denoise.py#L133-L169","documentation":"The Krea-2 denoise invocation requires at least one Krea2ConditioningField to build text conditioning. `_load_text_conditioning` normalizes the `conditioning_field` input to a list and throws when that list is empty. Without at least one conditioning field there are no prompt embeddings to guide the diffusion, so the invocation aborts early with a ValueError.","triggerScenarios":"Calling the `krea2_denoise` invocation with `conditioning_field` set to an empty list, or wiring a graph node whose Krea-2 conditioning input receives zero connections (e.g. a Collect node that collected nothing).","commonSituations":"Graph builders that conditionally connect a Krea-2 Text Condition / Prompt node but the prompt branch was disabled; dynamic workflows where a Collect produced an empty collection; programmatic graph generation that omitted the conditioning edge.","solutions":["Connect at least one Krea2ConditioningField (output of a Krea-2 prompt/conditioning invocation) to the denoise node's conditioning_field input.","If conditioning is collected dynamically, ensure the Collect node receives at least one item before the denoise step runs.","Check the workflow JSON/graph code for a missing or disabled edge feeding conditioning_field."],"exampleFix":"// before: empty list passed to denoise\nconditioning_field=[]\n// after: pass the conditioning field from a Krea-2 prompt invocation\nconditioning_field=prompt_invocation.conditioning  # single field\n# or a non-empty list of fields","handlingStrategy":"validation","validationCode":"fields = conditioning_field if isinstance(conditioning_field, list) else [conditioning_field]\nif not fields:\n    raise ValueError(\"krea2_denoise requires at least one conditioning field before invocation.\")","typeGuard":"def has_conditioning(cf) -> bool:\n    fields = cf if isinstance(cf, list) else [cf]\n    return len(fields) > 0","tryCatchPattern":"try:\n    result = context.services.graph.invoke(krea2_denoise)\nexcept ValueError as e:\n    if \"At least one Krea-2 conditioning\" in str(e):\n        # wire a default prompt conditioning and retry\n        ...\n    raise","preventionTips":["Always connect a prompt/conditioning node before the denoise node in the graph.","Validate that Collect nodes feeding conditioning_field are non-empty.","Add a pre-invocation graph lint that checks conditioning inputs are bound."],"tags":["invokeai","krea2","validation","missing-input"],"backgroundTag":"missing-required-input","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}