invoke-ai/InvokeAI · error · AssertionError

Unsupported controlnet type for control image preprocessing.

Error message

Unsupported controlnet type for control image preprocessing.

What it means

HiDiffusion's __call__ preprocesses the control image differently depending on the controlnet type. When the controlnet object is neither of the recognized types (e.g. not a diffusers ControlNetModel / MultiControlNetModel branch handled above), the code cannot know how to resize/arrange control images and raises AssertionError.

Source

Thrown at invokeai/backend/hidiffusion/hidiffusion.py:558

                    for control_image_ in control_image:
                        control_image_ = self.prepare_control_image(
                            image=control_image_,
                            width=width,
                            height=height,
                            batch_size=batch_size * num_images_per_prompt,
                            num_images_per_prompt=num_images_per_prompt,
                            device=device,
                            dtype=controlnet.dtype,
                            do_classifier_free_guidance=self.do_classifier_free_guidance,
                            guess_mode=guess_mode,
                        )

                        control_images.append(control_image_)

                    control_image = control_images
                    height, width = control_image[0].shape[-2:]
                else:
                    raise AssertionError("Unsupported controlnet type for control image preprocessing.")
            else:
                if isinstance(controlnet, ControlNetModel):
                    control_image = self.prepare_image(
                        image=control_image,
                        width=width,
                        height=height,
                        batch_size=batch_size * num_images_per_prompt,
                        num_images_per_prompt=num_images_per_prompt,
                        device=device,
                        dtype=controlnet.dtype,
                        do_classifier_free_guidance=self.do_classifier_free_guidance,
                        guess_mode=guess_mode,
                    )
                    height, width = control_image.shape[-2:]
                elif isinstance(controlnet, MultiControlNetModel):
                    images = []

                    for image_ in control_image:

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Pass a diffusers.models.controlnet.ControlNetModel (or the exact types the HiDiffusion branch supports) as controlnet
  2. Convert your custom controlnet wrapper to a supported ControlNetModel subclass
  3. Preprocess the control image yourself to the expected (B,C,H,W) size and bypass this branch
  4. Check the diffusers version matches what the HiDiffusion patch expects

Example fix

// before
pipeline.hidiffusion.apply_hidiffusion(...)  # controlnet = MyCustomControlNet()
// after
from diffusers.models.controlnet import ControlNetModel
assert isinstance(controlnet, ControlNetModel)
pipeline.hidiffusion.apply_hidiffusion(...)  # with supported controlnet
Defensive patterns

Strategy: type-guard

Validate before calling

from diffusers.models.controlnet import ControlNetModel
assert isinstance(controlnet, ControlNetModel), f"unsupported controlnet type: {type(controlnet)}"

Type guard

def is_supported_controlnet(c) -> bool:
    from diffusers.models.controlnet import ControlNetModel
    return isinstance(c, ControlNetModel)

Try / catch

try:
    result = pipeline(..., controlnet=controlnet)
except AssertionError as e:
    if "Unsupported controlnet type" in str(e):
        raise TypeError("Use a diffusers ControlNetModel with HiDiffusion") from e
    raise

Prevention

When it happens

Trigger: Calling the HiDiffusion-enabled pipeline with a custom or third-party controlnet implementation, a None/legacy controlnet, or a controlnet class not matching the isinstance checks in the preprocessing branch.

Common situations: Using custom ControlNet wrappers; diffusers version changes altering class names/hierarchy so isinstance checks fail; passing MultiControlNetModel where only single is supported (or vice versa).

Related errors


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