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
- Trim or summarize the prompt to under 1500 chars
- Move style/quality boilerplate into shorter directives or drop redundancy
- 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
- Summarize instead of truncating when possible (first sentence + key nouns)
- Enforce provider prompt limits in a shared pre-flight validator
- Track per-provider limits in config, not in ad-hoc code
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
- MiniMax image generation requires 'prompt'.
- MiniMax image width and height must be set together.
- prompt is required
- Unsupported MiniMax image model '{model}'.
- Kling avatar requires image_url or image_path
AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15).
Data as JSON: /api/errors/21734c581f8d5930.
Report an issue: GitHub.