MiniMax-AI/skills · error · SystemExit

No task_id in response

Error message

No task_id in response: {json.dumps(data, indent=2)}

What it means

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.

Solutions

  1. Inspect the dumped JSON to locate the actual identifier key and adapt the lookup.
  2. Retry once in case of a transient malformed response.
  3. Confirm the model name and region are a supported combination (unsupported combos can yield odd success shapes).
  4. If the key genuinely moved, update `data.get('task_id')` to read the correct field.

Example fix

// before: single expected key
task_id = data.get("task_id")

// after: tolerate common alternate keys
task_id = (data.get("task_id")
           or data.get("id")
           or data.get("data", {}).get("task_id"))
if not task_id:
    raise RuntimeError(f"no task_id in response: {data}")
Defensive patterns

Strategy: try-catch

Validate before calling

def read_task_id(data: dict):
    """Return task_id from any plausible location, else None."""
    for path in (("task_id",), ("id",), ("data", "task_id")):
        v = data
        for k in path:
            v = v.get(k, {}) if isinstance(v, dict) else None
        if v:
            return v
    return None

Type guard

def has_task_id(data: dict) -> bool:
    """True when the create response carries an identifier to poll."""
    return bool(read_task_id(data))

Try / catch

for attempt in range(2):
    data = create_task_api(payload)
    if data.get("base_resp", {}).get("status_code", 0) == 0:
        task_id = read_task_id(data)
        if task_id:
            return task_id
    time.sleep(3)
raise RuntimeError(f"no task_id after retries: {data}")

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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

Appendix: source

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

        "prompt": prompt,
        "duration": duration,
        "resolution": resolution,
        "prompt_optimizer": prompt_optimizer,
    }

    resp = requests.post(
        f"{API_BASE}/video_generation",
        headers=_headers(),
        json=payload,
        timeout=30,
    )
    resp.raise_for_status()
    data = resp.json()
    _check_resp(data)

    task_id = data.get("task_id")
    if not task_id:
        raise SystemExit(f"No task_id in response: {json.dumps(data, indent=2)}")
    return task_id


def poll_task(task_id: str, interval: int = 10, max_wait: int = 600) -> str:
    """Poll task status until Success. Returns file_id."""
    elapsed = 0
    while elapsed < max_wait:
        resp = requests.get(
            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", "")

View on GitHub (pinned to 60aaae52bb)