calesthio/OpenMontage · error · ValueError

MiniMax image prompt must not exceed 1500 characters.

Error message

MiniMax image prompt must not exceed 1500 characters.

What it means

Raised by MiniMaxImage._build_payload when the prompt string exceeds 1500 characters, which is the MiniMax image API's documented maximum prompt length. The tool enforces the limit locally so the request fails before hitting the server and burning a call.

Source

Thrown at tools/graphics/minimax_image.py:182

            path = path.with_suffix(".png")
        if count == 1:
            return [path]
        return [
            path.with_name(f"{path.stem}_{index}{path.suffix}")
            for index in range(1, count + 1)
        ]

    @staticmethod
    def _build_payload(inputs: dict[str, Any]) -> dict[str, Any]:
        model = inputs.get("model", DEFAULT_MODEL)
        if model not in MODELS:
            raise ValueError(f"Unsupported MiniMax image model '{model}'.")

        prompt = inputs.get("prompt")
        if not isinstance(prompt, str) or not prompt:
            raise ValueError("MiniMax image generation requires 'prompt'.")
        if len(prompt) > 1500:
            raise ValueError("MiniMax image prompt must not exceed 1500 characters.")

        width = inputs.get("width")
        height = inputs.get("height")
        if (width is None) != (height is None):
            raise ValueError("MiniMax image width and height must be set together.")

        payload: dict[str, Any] = {
            "model": model,
            "prompt": prompt,
            "response_format": inputs.get("response_format", "url"),
            "n": inputs.get("n", 1),
            "prompt_optimizer": inputs.get("prompt_optimizer", False),
        }
        for field in (
            "subject_reference",
            "aspect_ratio",
            "width",
            "height",

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Trim or summarize the prompt to under 1500 chars
  2. Move style/quality boilerplate into shorter directives or drop redundancy
  3. Truncate defensively: prompt = prompt[:1500] when length is untrusted

Example fix

# before
inputs = {"prompt": long_article_text}
# after
inputs = {"prompt": long_article_text[:1500]}
Defensive patterns

Strategy: validation

Validate before calling

MAX = 1500
if len(prompt) > MAX:
    prompt = prompt[:MAX]
inputs["prompt"] = prompt

Prevention

When it happens

Trigger: Feeding whole articles, scripts, or concatenated style descriptors as the prompt; concatenating prompt plus negative prompt plus JSON metadata into one string.

Common situations: Agent pipelines that dump long context into 'prompt'; reuse of LLM-generated captions without truncation.

Related errors


AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15). Data as JSON: /api/errors/21734c581f8d5930. Report an issue: GitHub.