{"record":{"id":"5515f8e0399acb78","repo":"invoke-ai/InvokeAI","slug":"unsupported-controlnet-type-for-control-image-prep","errorCode":null,"errorMessage":"Unsupported controlnet type for control image preprocessing.","messagePattern":"Unsupported controlnet type for control image preprocessing\\.","errorType":"exception","errorClass":"AssertionError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/hidiffusion/hidiffusion.py","lineNumber":558,"sourceCode":"                    for control_image_ in control_image:\n                        control_image_ = self.prepare_control_image(\n                            image=control_image_,\n                            width=width,\n                            height=height,\n                            batch_size=batch_size * num_images_per_prompt,\n                            num_images_per_prompt=num_images_per_prompt,\n                            device=device,\n                            dtype=controlnet.dtype,\n                            do_classifier_free_guidance=self.do_classifier_free_guidance,\n                            guess_mode=guess_mode,\n                        )\n\n                        control_images.append(control_image_)\n\n                    control_image = control_images\n                    height, width = control_image[0].shape[-2:]\n                else:\n                    raise AssertionError(\"Unsupported controlnet type for control image preprocessing.\")\n            else:\n                if isinstance(controlnet, ControlNetModel):\n                    control_image = self.prepare_image(\n                        image=control_image,\n                        width=width,\n                        height=height,\n                        batch_size=batch_size * num_images_per_prompt,\n                        num_images_per_prompt=num_images_per_prompt,\n                        device=device,\n                        dtype=controlnet.dtype,\n                        do_classifier_free_guidance=self.do_classifier_free_guidance,\n                        guess_mode=guess_mode,\n                    )\n                    height, width = control_image.shape[-2:]\n                elif isinstance(controlnet, MultiControlNetModel):\n                    images = []\n\n                    for image_ in control_image:","sourceCodeStart":540,"sourceCodeEnd":576,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/hidiffusion/hidiffusion.py#L540-L576","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Pass a diffusers.models.controlnet.ControlNetModel (or the exact types the HiDiffusion branch supports) as controlnet","Convert your custom controlnet wrapper to a supported ControlNetModel subclass","Preprocess the control image yourself to the expected (B,C,H,W) size and bypass this branch","Check the diffusers version matches what the HiDiffusion patch expects"],"exampleFix":"// before\npipeline.hidiffusion.apply_hidiffusion(...)  # controlnet = MyCustomControlNet()\n// after\nfrom diffusers.models.controlnet import ControlNetModel\nassert isinstance(controlnet, ControlNetModel)\npipeline.hidiffusion.apply_hidiffusion(...)  # with supported controlnet","handlingStrategy":"type-guard","validationCode":"from diffusers.models.controlnet import ControlNetModel\nassert isinstance(controlnet, ControlNetModel), f\"unsupported controlnet type: {type(controlnet)}\"","typeGuard":"def is_supported_controlnet(c) -> bool:\n    from diffusers.models.controlnet import ControlNetModel\n    return isinstance(c, ControlNetModel)","tryCatchPattern":"try:\n    result = pipeline(..., controlnet=controlnet)\nexcept AssertionError as e:\n    if \"Unsupported controlnet type\" in str(e):\n        raise TypeError(\"Use a diffusers ControlNetModel with HiDiffusion\") from e\n    raise","preventionTips":["Pin the diffusers version HiDiffusion was tested against","Re-check isinstance branches after diffusers upgrades","Wrap custom controlnets to expose a ControlNetModel-compatible interface"],"tags":["hidiffusion","controlnet","unsupported-value","preprocessing"],"backgroundTag":"unsupported-type","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}