vercel/ai · error · AISDKError

MINIMAX_VIDEO_GENERATION_EXPIRED

MINIMAX_VIDEO_GENERATION_EXPIRED

Error message

MiniMax video generation request expired. Task ID: ${taskId}

What it means

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.

Source

Thrown at packages/minimax/src/minimax-video-model.ts:676

        case 'failed': {
          throw new AISDKError({
            name: 'MINIMAX_VIDEO_GENERATION_FAILED',
            message: `MiniMax video generation failed${
              task.error?.message ? `: ${task.error.message}` : ''
            }${task.error?.code != null ? ` (${task.error.code})` : ''}. Task ID: ${taskId}`,
          });
        }

        case 'cancelled': {
          throw new AISDKError({
            name: 'MINIMAX_VIDEO_GENERATION_CANCELLED',
            message: `MiniMax video generation was cancelled. Task ID: ${taskId}`,
          });
        }

        case 'expired': {
          throw new AISDKError({
            name: 'MINIMAX_VIDEO_GENERATION_EXPIRED',
            message: `MiniMax video generation request expired. Task ID: ${taskId}`,
          });
        }

        // 'queued' | 'running' | unknown → keep polling.
        default:
          break;
      }
    }
  }
}

const minimaxCreateVideoResponseSchema = z.object({
  task_id: z.string().nullish(),
});

const minimaxVideoStatusResponseSchema = z.object({

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Retry with a fresh generateVideo call — the expired task cannot be resumed.
  2. Add retry/backoff around generation so expired tasks are automatically resubmitted.
  3. Avoid storing task IDs for later polling long after submission; poll promptly.
  4. If frequent, consider shorter/simpler prompts or off-peak submission to reduce queue time.

Example fix

// before: assuming an old taskId is still valid
const result = await generateVideo({ model, prompt, taskId: oldTaskId });
// after: on expiry, resubmit
try {
  await generateVideo({ model, prompt });
} catch (e) {
  if (e.name === 'MINIMAX_VIDEO_GENERATION_EXPIRED') {
    await generateVideo({ model, prompt });
  }
}
Defensive patterns

Strategy: retry

Try / catch

try {
  return await generateVideo({ model, prompt });
} catch (error) {
  if (
    typeof error === 'object' && error !== null &&
    (error as { name?: string }).name === 'MINIMAX_VIDEO_GENERATION_EXPIRED'
  ) {
    return generateVideo({ model, prompt }); // resubmit with backoff
  }
  throw error;
}

Prevention

When it happens

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

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

Related errors


AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30). Data as JSON: /api/errors/fe1aee24f8970870. Report an issue: GitHub.