{"record":{"id":"15d92ff95aae78d9","repo":"MiniMax-AI/skills","slug":"video-generation-failed-json-dumps-data-indent-15d92f","errorCode":null,"errorMessage":"Video generation failed: {json.dumps(data, indent=2)}","messagePattern":"Video generation failed: (.+?)","errorType":"exception","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"skills/gif-sticker-maker/scripts/minimax_video.py","lineNumber":137,"sourceCode":"            f\"{API_BASE}/query/video_generation\",\n            headers=_headers(),\n            params={\"task_id\": task_id},\n            timeout=30,\n        )\n        resp.raise_for_status()\n        data = resp.json()\n        _check_resp(data)\n\n        status = data.get(\"status\", \"\")\n        file_id = data.get(\"file_id\", \"\")\n\n        if status == \"Success\":\n            if not file_id:\n                raise SystemExit(\"Task succeeded but no file_id returned\")\n            print(f\"  Done! file_id={file_id}\")\n            return file_id\n        elif status == \"Fail\":\n            raise SystemExit(f\"Video generation failed: {json.dumps(data, indent=2)}\")\n        else:\n            print(f\"  [{elapsed}s] Status: {status}...\")\n            time.sleep(interval)\n            elapsed += interval\n\n    raise SystemExit(f\"Timeout after {max_wait}s. task_id={task_id}, check manually.\")\n\n\ndef download_video(file_id: str, output_path: str):\n    \"\"\"Retrieve download URL via file_id and save the video.\"\"\"\n    resp = requests.get(\n        f\"{API_BASE}/files/retrieve\",\n        headers=_headers(),\n        params={\"file_id\": file_id},\n        timeout=30,\n    )\n    resp.raise_for_status()\n    data = resp.json()","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/MiniMax-AI/skills/blob/60aaae52bb2af8162732751a4332f62a5fef518b/skills/gif-sticker-maker/scripts/minimax_video.py#L119-L155","documentation":"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.","triggerScenarios":"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.","commonSituations":"I2V first-frame image triggers moderation; prompt flagged; resolution/duration unsupported by the chosen model; transient model error during peak load.","solutions":["Read the dumped data for a base_resp or fault description.","For I2V, replace or sanitize the first-frame image.","Try a different model or lower the resolution/duration.","Rephrase the prompt to avoid moderation triggers; retry once."],"exampleFix":"# before\ntask_id = create_task(prompt=p, first_frame_image=img)\nfile_id = poll_task(task_id)  # SystemExit: Video generation failed\n\n# after - fall back to a different model/resolution\ntry:\n    file_id = poll_task(create_task(prompt=p, first_frame_image=img, resolution='720P'))\nexcept SystemExit as e:\n    file_id = poll_task(create_task(prompt=p, first_frame_image=img, model='T2V-01', resolution='768P'))","handlingStrategy":"fallback","validationCode":"# pre-screen I2V images: size/type limits\nfrom pathlib import Path\nif image_path:\n    sz = Path(image_path).stat().st_size\n    assert sz < 20 * 1024 * 1024, 'first-frame image must be < 20MB'\n    assert Path(image_path).suffix.lower() in ('.jpg','.jpeg','.png','.webp'), 'unsupported image type'","typeGuard":null,"tryCatchPattern":"try:\n    file_id = poll_task(task_id)\nexcept SystemExit as e:\n    if 'generation failed' in str(e).lower():\n        # retry with a safer config\n        file_id = poll_task(create_task(prompt=p, resolution='720P', duration=6))\n    else:\n        raise","preventionTips":["Pre-screen first-frame images for size (<20MB) and allowed types.","Keep a fallback model/resolution to retry on Fail.","Avoid policy-sensitive terms in prompts."],"tags":["api","video-generation","content-policy","minimax"],"backgroundTag":null,"analyzedSha":"60aaae52bb2af8162732751a4332f62a5fef518b","analyzedAt":"2026-08-13T17:32:34.717Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}