{"record":{"id":"fe1aee24f8970870","repo":"vercel/ai","slug":"minimax-video-generation-expired","errorCode":"MINIMAX_VIDEO_GENERATION_EXPIRED","errorMessage":"MiniMax video generation request expired. Task ID: ${taskId}","messagePattern":"MiniMax video generation request expired\\. Task ID: (.+?)","errorType":"exception","errorClass":"AISDKError","httpStatus":null,"severity":"error","filePath":"packages/minimax/src/minimax-video-model.ts","lineNumber":676,"sourceCode":"\n        case 'failed': {\n          throw new AISDKError({\n            name: 'MINIMAX_VIDEO_GENERATION_FAILED',\n            message: `MiniMax video generation failed${\n              task.error?.message ? `: ${task.error.message}` : ''\n            }${task.error?.code != null ? ` (${task.error.code})` : ''}. Task ID: ${taskId}`,\n          });\n        }\n\n        case 'cancelled': {\n          throw new AISDKError({\n            name: 'MINIMAX_VIDEO_GENERATION_CANCELLED',\n            message: `MiniMax video generation was cancelled. Task ID: ${taskId}`,\n          });\n        }\n\n        case 'expired': {\n          throw new AISDKError({\n            name: 'MINIMAX_VIDEO_GENERATION_EXPIRED',\n            message: `MiniMax video generation request expired. Task ID: ${taskId}`,\n          });\n        }\n\n        // 'queued' | 'running' | unknown → keep polling.\n        default:\n          break;\n      }\n    }\n  }\n}\n\nconst minimaxCreateVideoResponseSchema = z.object({\n  task_id: z.string().nullish(),\n});\n\nconst minimaxVideoStatusResponseSchema = z.object({","sourceCodeStart":658,"sourceCodeEnd":694,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/minimax/src/minimax-video-model.ts#L658-L694","documentation":"While polling, MiniMax reported the video generation task status as 'expired': the task lived past its TTL without completing. The SDK throws MINIMAX_VIDEO_GENERATION_EXPIRED because the task ID is now dead and polling further is pointless.","triggerScenarios":"doGenerate polls a MiniMax video task whose status returns 'expired' — the task was queued too long (very long queue) or MiniMax purged it before it started running.","commonSituations":"Heavy MiniMax load causing long queues; a task left unpolled for a long time and re-polled later; jobs submitted with a prompt/config that MiniMax deferred until they aged out.","solutions":["Retry with a fresh generateVideo call — the expired task cannot be resumed.","Add retry/backoff around generation so expired tasks are automatically resubmitted.","Avoid storing task IDs for later polling long after submission; poll promptly.","If frequent, consider shorter/simpler prompts or off-peak submission to reduce queue time."],"exampleFix":"// before: assuming an old taskId is still valid\nconst result = await generateVideo({ model, prompt, taskId: oldTaskId });\n// after: on expiry, resubmit\ntry {\n  await generateVideo({ model, prompt });\n} catch (e) {\n  if (e.name === 'MINIMAX_VIDEO_GENERATION_EXPIRED') {\n    await generateVideo({ model, prompt });\n  }\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  return await generateVideo({ model, prompt });\n} catch (error) {\n  if (\n    typeof error === 'object' && error !== null &&\n    (error as { name?: string }).name === 'MINIMAX_VIDEO_GENERATION_EXPIRED'\n  ) {\n    return generateVideo({ model, prompt }); // resubmit with backoff\n  }\n  throw error;\n}","preventionTips":["Poll submitted tasks promptly instead of storing IDs for later.","Add automatic resubmission with exponential backoff for terminal statuses.","Monitor MiniMax queue load; submit during off-peak when queues are long."],"tags":["minimax","video-generation","task-expired","async-polling"],"backgroundTag":"task-expired-provider-timeout","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}