MiniMax-AI/skills · error · SystemExit

Video generation failed: {json.dumps(data, indent=2)}

Error message

Video generation failed: {json.dumps(data, indent=2)}

What it means

poll_task() observed status == 'Fail'. The async job ran but the server reports failure — content moderation on frames, model internal error, or resource limits. The full JSON is dumped including any base_resp/fault hints for diagnosis.

Source

Thrown at skills/gif-sticker-maker/scripts/minimax_video.py:137

            f"{API_BASE}/query/video_generation",
            headers=_headers(),
            params={"task_id": task_id},
            timeout=30,
        )
        resp.raise_for_status()
        data = resp.json()
        _check_resp(data)

        status = data.get("status", "")
        file_id = data.get("file_id", "")

        if status == "Success":
            if not file_id:
                raise SystemExit("Task succeeded but no file_id returned")
            print(f"  Done! file_id={file_id}")
            return file_id
        elif status == "Fail":
            raise SystemExit(f"Video generation failed: {json.dumps(data, indent=2)}")
        else:
            print(f"  [{elapsed}s] Status: {status}...")
            time.sleep(interval)
            elapsed += interval

    raise SystemExit(f"Timeout after {max_wait}s. task_id={task_id}, check manually.")


def download_video(file_id: str, output_path: str):
    """Retrieve download URL via file_id and save the video."""
    resp = requests.get(
        f"{API_BASE}/files/retrieve",
        headers=_headers(),
        params={"file_id": file_id},
        timeout=30,
    )
    resp.raise_for_status()
    data = resp.json()

View on GitHub (pinned to 60aaae52bb)

Solutions

  1. Read the dumped data for a base_resp or fault description.
  2. For I2V, replace or sanitize the first-frame image.
  3. Try a different model or lower the resolution/duration.
  4. Rephrase the prompt to avoid moderation triggers; retry once.

Example fix

# before
task_id = create_task(prompt=p, first_frame_image=img)
file_id = poll_task(task_id)  # SystemExit: Video generation failed

# after - fall back to a different model/resolution
try:
    file_id = poll_task(create_task(prompt=p, first_frame_image=img, resolution='720P'))
except SystemExit as e:
    file_id = poll_task(create_task(prompt=p, first_frame_image=img, model='T2V-01', resolution='768P'))
Defensive patterns

Strategy: fallback

Validate before calling

# pre-screen I2V images: size/type limits
from pathlib import Path
if image_path:
    sz = Path(image_path).stat().st_size
    assert sz < 20 * 1024 * 1024, 'first-frame image must be < 20MB'
    assert Path(image_path).suffix.lower() in ('.jpg','.jpeg','.png','.webp'), 'unsupported image type'

Try / catch

try:
    file_id = poll_task(task_id)
except SystemExit as e:
    if 'generation failed' in str(e).lower():
        # retry with a safer config
        file_id = poll_task(create_task(prompt=p, resolution='720P', duration=6))
    else:
        raise

Prevention

When it happens

Trigger: GET query/video_generation returns status 'Fail' for the task_id. For I2V, often the first-frame image violates policy; for T2V, the prompt is flagged; otherwise an unsupported resolution/duration for the model or a model-side error.

Common situations: I2V first-frame image triggers moderation; prompt flagged; resolution/duration unsupported by the chosen model; transient model error during peak load.

Related errors


AI-assisted analysis of MiniMax-AI/skills@60aaae52bb (2026-08-13). Data as JSON: /api/errors/15d92ff95aae78d9. Report an issue: GitHub.