{"record":{"id":"050191741498cec3","repo":"invoke-ai/InvokeAI","slug":"unknown-controlnet-conditioning-channel-order","errorCode":null,"errorMessage":"unknown `controlnet_conditioning_channel_order`: {channel_order}","messagePattern":"unknown `controlnet_conditioning_channel_order`: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/util/hotfixes.py","lineNumber":632,"sourceCode":"                you remove all prompts. A `guidance_scale` between 3.0 and 5.0 is recommended.\n            return_dict (`bool`, defaults to `True`):\n                Whether or not to return a [`~models.controlnet.ControlNetOutput`] instead of a plain tuple.\n\n        Returns:\n            [`~models.controlnet.ControlNetOutput`] **or** `tuple`:\n                If `return_dict` is `True`, a [`~models.controlnet.ControlNetOutput`] is returned, otherwise a tuple is\n                returned where the first element is the sample tensor.\n        \"\"\"\n        # check channel order\n        channel_order = self.config.controlnet_conditioning_channel_order\n\n        if channel_order == \"rgb\":\n            # in rgb order by default\n            ...\n        elif channel_order == \"bgr\":\n            controlnet_cond = torch.flip(controlnet_cond, dims=[1])\n        else:\n            raise ValueError(f\"unknown `controlnet_conditioning_channel_order`: {channel_order}\")\n\n        # prepare attention_mask\n        if attention_mask is not None:\n            attention_mask = (1 - attention_mask.to(sample.dtype)) * -10000.0\n            attention_mask = attention_mask.unsqueeze(1)\n\n        # convert encoder_attention_mask to a bias the same way we do for attention_mask\n        if encoder_attention_mask is not None:\n            encoder_attention_mask = (1 - encoder_attention_mask.to(sample.dtype)) * -10000.0\n            encoder_attention_mask = encoder_attention_mask.unsqueeze(1)\n\n        # 1. time\n        timesteps = timestep\n        if not torch.is_tensor(timesteps):\n            # TODO: this requires sync between CPU and GPU. So try to pass timesteps as tensors if you can\n            # This would be a good case for the `match` statement (Python 3.10+)\n            is_mps = sample.device.type == \"mps\"\n            if isinstance(timestep, float):","sourceCodeStart":614,"sourceCodeEnd":650,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/util/hotfixes.py#L614-L650","documentation":"The patched ControlNetModel.forward (in InvokeAI's hotfixes) only accepts controlnet_conditioning_channel_order of 'rgb' or 'bgr'. Any other string reaches this final else and raises. The order controls whether the conditioning image is channel-flipped before use.","triggerScenarios":"Calling ControlNet forward (directly or via a pipeline) with controlnet_conditioning_channel_order set to something other than \"rgb\" or \"bgr\", e.g. None, \"RGB\" (case-sensitive), or a typo like \"bgrx\".","commonSituations":"Typos or wrong casing in pipeline kwargs; porting code from another library that uses different naming; loading a config whose channel_order field was edited by hand.","solutions":["Set controlnet_conditioning_channel_order to exactly \"rgb\" or \"bgr\" (lowercase)","Omit the argument entirely to use the default rgb order","Check the caller that forwards kwargs to ControlNet forward for a mis-serialized value"],"exampleFix":"// before\ncontrolnet(..., controlnet_conditioning_channel_order=\"RGB\")\n// after\ncontrolnet(..., controlnet_conditioning_channel_order=\"rgb\")","handlingStrategy":"validation","validationCode":"VALID_ORDERS = {\"rgb\", \"bgr\"}\nif channel_order is not None and channel_order not in VALID_ORDERS:\n    channel_order = \"rgb\"","typeGuard":"def is_valid_channel_order(v):\n    return v in (\"rgb\", \"bgr\")","tryCatchPattern":"try:\n    out = controlnet(..., controlnet_conditioning_channel_order=order)\nexcept ValueError as e:\n    logger.error(\"bad channel_order %r: %s\", order, e)\n    raise","preventionTips":["Use literal \"rgb\"/\"bgr\" constants, never user input","Remember the check is case-sensitive lowercase","Omit the kwarg to accept the default"],"tags":["valueerror","controlnet","invalid-argument"],"backgroundTag":"invalid-enum-value","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}