{"record":{"id":"591f63ca43d1101d","repo":"MiniMax-AI/skills","slug":"no-task-id-in-response-json-dumps-data-indent-2","errorCode":null,"errorMessage":"No task_id in response: {json.dumps(data, indent=2)}","messagePattern":"No task_id in response: (.+?)","errorType":"exception","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"skills/frontend-dev/scripts/minimax_video.py","lineNumber":74,"sourceCode":"        \"prompt\": prompt,\n        \"duration\": duration,\n        \"resolution\": resolution,\n        \"prompt_optimizer\": prompt_optimizer,\n    }\n\n    resp = requests.post(\n        f\"{API_BASE}/video_generation\",\n        headers=_headers(),\n        json=payload,\n        timeout=30,\n    )\n    resp.raise_for_status()\n    data = resp.json()\n    _check_resp(data)\n\n    task_id = data.get(\"task_id\")\n    if not task_id:\n        raise SystemExit(f\"No task_id in response: {json.dumps(data, indent=2)}\")\n    return task_id\n\n\ndef poll_task(task_id: str, interval: int = 10, max_wait: int = 600) -> str:\n    \"\"\"Poll task status until Success. Returns file_id.\"\"\"\n    elapsed = 0\n    while elapsed < max_wait:\n        resp = requests.get(\n            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\", \"\")","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/MiniMax-AI/skills/blob/60aaae52bb2af8162732751a4332f62a5fef518b/skills/frontend-dev/scripts/minimax_video.py#L56-L92","documentation":"create_task() got HTTP 2xx and base_resp.status_code 0, but the response has no task_id field. task_id is required to poll the async job, so without it the pipeline cannot continue. The full JSON is dumped.","triggerScenarios":"A create-task response that succeeded at the API level but omitted task_id — an API schema change, an alternate success shape for a model/region, or an endpoint that returned a different identifier field name.","commonSituations":"Model or region returns the id under a different key (e.g. id, data.task_id); API version drift; an account-tier-specific response shape; rarely a transient malformed response.","solutions":["Inspect the dumped JSON to locate the actual identifier key and adapt the lookup.","Retry once in case of a transient malformed response.","Confirm the model name and region are a supported combination (unsupported combos can yield odd success shapes).","If the key genuinely moved, update `data.get('task_id')` to read the correct field."],"exampleFix":"// before: single expected key\ntask_id = data.get(\"task_id\")\n\n// after: tolerate common alternate keys\ntask_id = (data.get(\"task_id\")\n           or data.get(\"id\")\n           or data.get(\"data\", {}).get(\"task_id\"))\nif not task_id:\n    raise RuntimeError(f\"no task_id in response: {data}\")","handlingStrategy":"try-catch","validationCode":"def read_task_id(data: dict):\n    \"\"\"Return task_id from any plausible location, else None.\"\"\"\n    for path in ((\"task_id\",), (\"id\",), (\"data\", \"task_id\")):\n        v = data\n        for k in path:\n            v = v.get(k, {}) if isinstance(v, dict) else None\n        if v:\n            return v\n    return None","typeGuard":"def has_task_id(data: dict) -> bool:\n    \"\"\"True when the create response carries an identifier to poll.\"\"\"\n    return bool(read_task_id(data))","tryCatchPattern":"for attempt in range(2):\n    data = create_task_api(payload)\n    if data.get(\"base_resp\", {}).get(\"status_code\", 0) == 0:\n        task_id = read_task_id(data)\n        if task_id:\n            return task_id\n    time.sleep(3)\nraise RuntimeError(f\"no task_id after retries: {data}\")","preventionTips":["Tolerate alternate identifier keys (id, data.task_id) when reading the create response.","Retry create once — a missing task_id can be a transient malformed response.","Confirm the model/region combo is supported, as odd success shapes often come from unsupported combos.","Log the full create response when task_id is absent to catch schema drift."],"tags":["api","data-integrity","minimax","video"],"backgroundTag":null,"analyzedSha":"60aaae52bb2af8162732751a4332f62a5fef518b","analyzedAt":"2026-08-13T17:32:34.717Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}