invoke-ai/InvokeAI · error · ValueError

At least one Krea-2 conditioning is required.

Error message

At least one Krea-2 conditioning is required.

What it means

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.

Source

Thrown at invokeai/app/invocations/krea2_denoise.py:151

            antialias=False,
        )
        mask = mask.to(device=latents.device, dtype=latents.dtype)
        return mask

    def _load_text_conditioning(
        self,
        context: InvocationContext,
        conditioning_field: Krea2ConditioningField | list[Krea2ConditioningField],
        grid_height: int,
        grid_width: int,
        dtype: torch.dtype,
        device: torch.device,
    ) -> Krea2RegionalPromptingExtension:
        conditioning_fields = (
            [conditioning_field] if isinstance(conditioning_field, Krea2ConditioningField) else conditioning_field
        )
        if not conditioning_fields:
            raise ValueError("At least one Krea-2 conditioning is required.")

        text_conditionings: list[Krea2TextConditioning] = []
        for field in conditioning_fields:
            cond_data = context.conditioning.load(field.conditioning_name)
            assert len(cond_data.conditionings) == 1
            conditioning = cond_data.conditionings[0]
            assert isinstance(conditioning, Krea2ConditioningInfo)
            conditioning = conditioning.to(dtype=dtype, device=device)
            embeds = conditioning.prompt_embeds
            if conditioning.prompt_embeds_mask is not None:
                mask = conditioning.prompt_embeds_mask.to(device=device, dtype=torch.bool)
                if mask.shape != embeds.shape[:2]:
                    raise ValueError(
                        f"Krea-2 conditioning mask shape {tuple(mask.shape)} does not match "
                        f"prompt embedding shape {tuple(embeds.shape[:2])}."
                    )
                valid_token_counts = mask.sum(dim=1)
                if not torch.equal(valid_token_counts, valid_token_counts[:1].expand_as(valid_token_counts)):

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Connect at least one Krea2ConditioningField (output of a Krea-2 prompt/conditioning invocation) to the denoise node's conditioning_field input.
  2. If conditioning is collected dynamically, ensure the Collect node receives at least one item before the denoise step runs.
  3. Check the workflow JSON/graph code for a missing or disabled edge feeding conditioning_field.

Example fix

// before: empty list passed to denoise
conditioning_field=[]
// after: pass the conditioning field from a Krea-2 prompt invocation
conditioning_field=prompt_invocation.conditioning  # single field
# or a non-empty list of fields
Defensive patterns

Strategy: validation

Validate before calling

fields = conditioning_field if isinstance(conditioning_field, list) else [conditioning_field]
if not fields:
    raise ValueError("krea2_denoise requires at least one conditioning field before invocation.")

Type guard

def has_conditioning(cf) -> bool:
    fields = cf if isinstance(cf, list) else [cf]
    return len(fields) > 0

Try / catch

try:
    result = context.services.graph.invoke(krea2_denoise)
except ValueError as e:
    if "At least one Krea-2 conditioning" in str(e):
        # wire a default prompt conditioning and retry
        ...
    raise

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/3aa9f43562bead51. Report an issue: GitHub.