{"record":{"id":"f51017683fc35c3c","repo":"calesthio/OpenMontage","slug":"minimax-image-generation-requires-prompt","errorCode":null,"errorMessage":"MiniMax image generation requires 'prompt'.","messagePattern":"MiniMax image generation requires 'prompt'\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/graphics/minimax_image.py","lineNumber":180,"sourceCode":"        path = Path(output_path or \"minimax_image.png\")\n        if not path.suffix:\n            path = path.with_suffix(\".png\")\n        if count == 1:\n            return [path]\n        return [\n            path.with_name(f\"{path.stem}_{index}{path.suffix}\")\n            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\",","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/graphics/minimax_image.py#L162-L198","documentation":"Raised by MiniMaxImage._build_payload when 'prompt' is absent, not a string (e.g. None, a list, a number), or an empty string. The MiniMax image endpoint requires a textual prompt, so the tool rejects the call client-side. Note it also rejects non-string truthy values, unlike some sibling tools.","triggerScenarios":"Omitting prompt; passing prompt=None when a template produced nothing; passing a list of prompt strings or a dict by mistake.","commonSituations":"Prompt built from optional upstream metadata (product name, scene description) that was empty; passing structured prompt objects accepted by other tools.","solutions":["Pass a non-empty prompt string","Coerce upstream values to str and default to a fallback description when empty","Add a pre-call isinstance(prompt, str) and prompt.strip() check in pipeline code"],"exampleFix":"# before\ninputs = {\"prompt\": None, \"aspect_ratio\": \"16:9\"}\n# after\ninputs = {\"prompt\": \"minimal product shot on marble\", \"aspect_ratio\": \"16:9\"}","handlingStrategy":"validation","validationCode":"prompt = inputs.get(\"prompt\")\nif not isinstance(prompt, str) or not prompt.strip():\n    raise ValueError(\"'prompt' must be a non-empty string\")","typeGuard":"def is_valid_prompt(value: Any) -> bool:\n    return isinstance(value, str) and bool(value.strip())","tryCatchPattern":null,"preventionTips":["Coerce all prompt inputs to str at the pipeline boundary","Default to a fallback descriptor when composed prompts are empty","Add schema validation (pydantic/jsonschema) on tool inputs"],"tags":["minimax","image-generation","input-validation","prompt"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}