invoke-ai/InvokeAI · error · ValueError

This Anima ControlNet-LLLite adapter is an inpainting adapte

Error message

This Anima ControlNet-LLLite adapter is an inpainting adapter (4-channel conditioning) and requires a mask. Connect a mask (white = inpaint area) to the Anima ControlNet-LLLite node.

What it means

_build_lllite_cond_image builds the conditioning image for an LLLite adapter. If the loaded adapter expects 4-channel conditioning (cond_in_channels == 4, i.e. an inpainting adapter) but the AnimaLLLiteField has no mask_name, a ValueError is raised explaining that a mask is required.

Source

Thrown at invokeai/app/invocations/anima_denoise.py:327

        lllite_field: AnimaLLLiteField,
        lllite_model: AnimaControlNetLLLite,
        latents: torch.Tensor,
        patch_spatial: int = 2,
    ) -> torch.Tensor:
        """Build one adapter's LLLite conditioning image tensor (once per generation).

        The cond image is sized from the ACTUAL latent H/W (mirroring the DiT's
        patch padding) — see target_cond_hw in the backend module.
        """
        latent_h, latent_w = latents.shape[-2], latents.shape[-1]

        image_pil = context.images.get_pil(lllite_field.image_name, "RGB")
        rgb_01 = to_tensor(image_pil).unsqueeze(0)  # (1, 3, H, W) in [0, 1]
        rgb_pm1 = prepare_cond_image(rgb_01, latent_h, latent_w, patch_spatial)

        if lllite_model.cond_in_channels == 4:
            if lllite_field.mask_name is None:
                raise ValueError(
                    "This Anima ControlNet-LLLite adapter is an inpainting adapter (4-channel conditioning) and "
                    "requires a mask. Connect a mask (white = inpaint area) to the Anima ControlNet-LLLite node."
                )
            mask_pil = context.images.get_pil(lllite_field.mask_name, "L")
            mask_01 = to_tensor(mask_pil).unsqueeze(0)  # (1, 1, H, W) in [0, 1]
            mask_01 = prepare_mask(mask_01, latent_h, latent_w, patch_spatial)
            return build_inpaint_cond_image(rgb_pm1, mask_01, lllite_model.inpaint_masked_input)

        if lllite_model.cond_in_channels != 3:
            raise ValueError(
                f"Unsupported Anima ControlNet-LLLite adapter: expected 3 or 4 conditioning channels, got "
                f"{lllite_model.cond_in_channels}."
            )
        if lllite_field.mask_name is not None:
            context.logger.warning(
                "The selected Anima ControlNet-LLLite adapter does not use a mask (3-channel conditioning); the "
                "connected mask will be ignored."
            )

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Connect a mask image (white = inpaint area) to the ControlNet-LLLite node's mask input
  2. Switch to a 3-channel (non-inpaint) LLLite adapter if no mask is desired
  3. Regenerate the workflow graph so the mask field is populated

Example fix

// before
field = AnimaLLLiteField(control_model=m, image_name="cond")
// after
field = AnimaLLLiteField(control_model=m, image_name="cond", mask_name="mask_png")
Defensive patterns

Strategy: validation

Validate before calling

if lllite_model.cond_in_channels == 4 and lllite_field.mask_name is None:
    raise ValueError('inpaint LLLite adapter requires a connected mask')

Type guard

def lllite_mask_ok(model, field: AnimaLLLiteField) -> bool:
    return model.cond_in_channels != 4 or field.mask_name is not None

Try / catch

try:
    cond = _build_lllite_cond_image(context, lllite_field, lllite_model, ...)
except ValueError as e:
    if 'requires a mask' in str(e):
        raise NodeInputError('Connect a mask to the Anima ControlNet-LLLite node') from e
    raise

Prevention

When it happens

Trigger: Running Anima diffusion with an inpainting-type ControlNet-LLLite adapter whose field lacks mask_name — the loader node was given a control image but no mask image.

Common situations: Using an inpaint-trained LLLite adapter intended for masked conditioning without connecting a mask; swapping a 3-channel adapter for an inpaint adapter in an existing workflow that has no mask input wired.

Related errors


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