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() saw status=='Fail' — the backend reports the video generation did not succeed. The full JSON (which usually contains a fail reason/code) is dumped. This is a terminal state for the task; it will not transition to Success on its own.

Source

Thrown at skills/frontend-dev/scripts/minimax_video.py:101

            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 JSON for the fail reason/code and address it directly (content, params, or model).
  2. Simplify: lower resolution (768P/720P), reduce duration to 6, disable prompt_optimizer, remove camera brackets.
  3. Rephrase the prompt to avoid policy-sensitive terms and retry as a NEW task (the failed task_id cannot be revived).
  4. Confirm model/resolution/duration is a supported combo for your account/region.

Example fix

// before: hard fail, lose the reason inside a SystemExit string
elif status == "Fail":
    raise SystemExit(f"failed: {data}")

// after: surface the structured fail code for actionable handling
elif status == "Fail":
    reason = data.get("fail_info", {}).get("reason", "unknown")
    if reason in ("content_policy", "sensitive"):
        prompt = sanitize(prompt)
    raise VideoGenFailed(task_id, reason, data)
Defensive patterns

Strategy: try-catch

Validate before calling

def safe_prompt(prompt: str) -> str:
    """Trim length and strip content-policy-sensitive tokens before submit."""
    p = prompt[:2000]
    for token in ("[Truck left]", "[Push in]"):
        p = p.replace(token, "")  # drop camera cmds unsupported by the model
    return p.strip() or "a short clip"

Type guard

def is_failed_status(data: dict) -> bool:
    """True when the video task reached a terminal Fail state."""
    return data.get("status") == "Fail"

Try / catch

import subprocess, sys
try:
    subprocess.run([sys.executable, "minimax_video.py", prompt, "-o", out, "--resolution", "768P"], check=True, capture_output=True, text=True)
except subprocess.CalledProcessError as e:
    msg = (e.stderr or "") + (e.stdout or "")
    if "Video generation failed" in msg:
        # create a NEW task with a sanitized prompt / lower params
        subprocess.run([sys.executable, "minimax_video.py", safe_prompt(prompt), "-o", out, "--resolution", "720P"], check=True)
    else:
        raise

Prevention

When it happens

Trigger: Content-policy rejection of the prompt; prompt exceeding 2000 chars or malformed camera-command brackets; an unsupported model/resolution/duration combination that the API accepted at create but rejected at generation; internal backend generation error; unsafe/toxic content detection.

Common situations: Prompt with disallowed content; camera commands like [Truck left]/[Push in] used with a model that doesn't support them; 1080P requested on a model/tier without it; overloaded backend marking tasks Fail; region/key mismatch causing generation-side rejection.

Related errors


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