{"record":{"id":"61378ec13598bdf8","repo":"Comfy-Org/ComfyUI","slug":"bria-accepts-a-width-to-height-ratio-between-bria","errorCode":null,"errorMessage":"Bria accepts a width-to-height ratio between {BRIA_MIN_RATIO} and {BRIA_MAX_RATIO}: {ratio_width}:{ratio_height} is {aspect_ratio:.4f}. Use the manual expand mode to reach a canvas of any shape.","messagePattern":"Bria accepts a width-to-height ratio between (.+?) and (.+?): (.+?):(.+?) is (.+?)\\. Use the manual expand mode to reach a canvas of any shape\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_bria.py","lineNumber":625,"sourceCode":"        cls,\n        image: Input.Image,\n        expand_mode: dict,\n        prompt: str,\n        negative_prompt: str,\n        seed: int,\n        moderation: InputModerationSettings,\n    ) -> IO.NodeOutput:\n        mode = expand_mode[\"expand_mode\"]\n        aspect_ratio = canvas_size = original_image_size = original_image_location = None\n        if mode == \"manual\":\n            canvas_size = [expand_mode[\"canvas_width\"], expand_mode[\"canvas_height\"]]\n            original_image_size = [expand_mode[\"image_width\"], expand_mode[\"image_height\"]]\n            original_image_location = [expand_mode[\"image_x\"], expand_mode[\"image_y\"]]\n        elif mode == \"custom_ratio\":\n            ratio_width, ratio_height = expand_mode[\"ratio_width\"], expand_mode[\"ratio_height\"]\n            aspect_ratio = ratio_width / ratio_height\n            if not BRIA_MIN_RATIO <= aspect_ratio <= BRIA_MAX_RATIO:\n                raise ValueError(\n                    f\"Bria accepts a width-to-height ratio between {BRIA_MIN_RATIO} and {BRIA_MAX_RATIO}: \"\n                    f\"{ratio_width}:{ratio_height} is {aspect_ratio:.4f}. \"\n                    f\"Use the manual expand mode to reach a canvas of any shape.\"\n                )\n        else:\n            aspect_ratio = mode\n        response = await sync_op(\n            cls,\n            ApiEndpoint(path=\"/proxy/bria/v2/image/edit/expand\", method=\"POST\"),\n            data=BriaExpandRequest(\n                image=await upload_image_to_comfyapi(cls, image, total_pixels=None, wait_label=\"Uploading image\"),\n                aspect_ratio=aspect_ratio,\n                canvas_size=canvas_size,\n                original_image_size=original_image_size,\n                original_image_location=original_image_location,\n                prompt=prompt if prompt else None,\n                negative_prompt=negative_prompt if negative_prompt else None,\n                seed=seed,","sourceCodeStart":607,"sourceCodeEnd":643,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_bria.py#L607-L643","documentation":"In Bria expand's 'custom_ratio' mode, the requested width:height ratio must fall between BRIA_MIN_RATIO and BRIA_MAX_RATIO (Bria's API-side canvas limits). The node computes ratio_width/ratio_height and rejects out-of-range ratios before the request, pointing you at manual mode for extreme shapes.","triggerScenarios":"expand_mode['expand_mode'] == 'custom_ratio' with e.g. ratio_width=10, ratio_height=1 (ratio 10.0) or 1:10, outside the accepted band.","commonSituations":"User wants a very wide banner or very tall poster via custom ratio; ratio entered reversed (height where width goes) producing an extreme value.","solutions":["Keep the custom ratio within BRIA_MIN_RATIO..BRIA_MAX_RATIO (check the constants in nodes_bria.py, typically around 0.25-4).","For extreme canvas shapes, switch expand_mode to 'manual' and set canvas_width/canvas_height plus image placement directly.","Double-check ratio_width and ratio_height are not swapped."],"exampleFix":"// before\nmode: 'custom_ratio', ratio_width: 16, ratio_height: 1\n// after\nmode: 'manual', canvas_width: 4096, canvas_height: 256, image_width: 512, image_height: 256, image_x: 0, image_y: 0","handlingStrategy":"validation","validationCode":"ratio = ratio_width / ratio_height\nif not BRIA_MIN_RATIO <= ratio <= BRIA_MAX_RATIO:\n    mode = 'manual'  # fall back to explicit canvas size","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep custom ratios near 1:1..2:1; use manual expand mode for banners or tall posters.","Sanity-check that ratio_width/ratio_height are in the intended order."],"tags":["comfyui","bria","aspect-ratio","validation","limits"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}