{"record":{"id":"f546327edfd2c447","repo":"calesthio/OpenMontage","slug":"minimax-image-width-and-height-must-be-set-togethe","errorCode":null,"errorMessage":"MiniMax image width and height must be set together.","messagePattern":"MiniMax image width and height must be set together\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/graphics/minimax_image.py","lineNumber":187,"sourceCode":"            for index in range(1, count + 1)\n        ]\n\n    @staticmethod\n    def _build_payload(inputs: dict[str, Any]) -> dict[str, Any]:\n        model = inputs.get(\"model\", DEFAULT_MODEL)\n        if model not in MODELS:\n            raise ValueError(f\"Unsupported MiniMax image model '{model}'.\")\n\n        prompt = inputs.get(\"prompt\")\n        if not isinstance(prompt, str) or not prompt:\n            raise ValueError(\"MiniMax image generation requires 'prompt'.\")\n        if len(prompt) > 1500:\n            raise ValueError(\"MiniMax image prompt must not exceed 1500 characters.\")\n\n        width = inputs.get(\"width\")\n        height = inputs.get(\"height\")\n        if (width is None) != (height is None):\n            raise ValueError(\"MiniMax image width and height must be set together.\")\n\n        payload: dict[str, Any] = {\n            \"model\": model,\n            \"prompt\": prompt,\n            \"response_format\": inputs.get(\"response_format\", \"url\"),\n            \"n\": inputs.get(\"n\", 1),\n            \"prompt_optimizer\": inputs.get(\"prompt_optimizer\", False),\n        }\n        for field in (\n            \"subject_reference\",\n            \"aspect_ratio\",\n            \"width\",\n            \"height\",\n            \"seed\",\n        ):\n            if inputs.get(field) is not None:\n                payload[field] = inputs[field]\n        return payload","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/graphics/minimax_image.py#L169-L205","documentation":"Raised by MiniMaxImage._build_payload when exactly one of 'width'/'height' is provided (XOR check via (width is None) != (height is None)). The API expects dimensions as a pair, so a lone dimension is rejected client-side. Use 'aspect_ratio' alone if you don't need explicit pixel sizes.","triggerScenarios":"Setting width=1280 but forgetting height; height inherited from a template while width was overridden; passing height=0 (not None) with no width, which still fails the pair rule only if the other is None.","commonSituations":"Config partial-override patterns (set one dimension, expect the other to default); merging configs where one key was dropped.","solutions":["Set both width and height together, or neither","If only the shape matters, use aspect_ratio instead of explicit dimensions","Validate pairs in your config loader before invoking the tool"],"exampleFix":"# before\ninputs = {\"prompt\": \"...\", \"width\": 1280}\n# after\ninputs = {\"prompt\": \"...\", \"width\": 1280, \"height\": 720}","handlingStrategy":"validation","validationCode":"w, h = inputs.get(\"width\"), inputs.get(\"height\")\nif (w is None) != (h is None):\n    raise ValueError(\"set width+height together, or use aspect_ratio\")","typeGuard":"def has_paired_dimensions(inputs: dict) -> bool:\n    return (inputs.get(\"width\") is None) == (inputs.get(\"height\") is None)","tryCatchPattern":null,"preventionTips":["Prefer aspect_ratio unless exact pixels are required","Reject partial dimension configs in your loader","Keep dimension pairs as tuples in config so they can't diverge"],"tags":["minimax","image-generation","input-validation","dimensions"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}