vercel/ai · error · AISDKError

MINIMAX_VIDEO_GENERATION_TIMEOUT

MINIMAX_VIDEO_GENERATION_TIMEOUT

Error message

MiniMax video generation timed out after ${pollTimeoutMs}ms. Task ID: ${taskId}

What it means

Video generation is asynchronous: doGenerate polls the task status with a delay between requests and gives up once pollTimeoutMs has elapsed since submission, throwing MINIMAX_VIDEO_GENERATION_TIMEOUT with the task ID. The job may still be running server-side; the client simply stopped waiting.

Source

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

    if (!taskId) {
      throw new AISDKError({
        name: 'MINIMAX_VIDEO_GENERATION_ERROR',
        message: `No task_id returned from the MiniMax API. Response: ${JSON.stringify(createResponse)}`,
      });
    }

    const pollIntervalMs =
      minimaxOptions?.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
    const pollTimeoutMs =
      minimaxOptions?.pollTimeoutMs ?? DEFAULT_POLL_TIMEOUT_MS;
    const startTime = Date.now();
    let responseHeaders: Record<string, string> | undefined;

    while (true) {
      await delay(pollIntervalMs, { abortSignal: options.abortSignal });

      if (Date.now() - startTime > pollTimeoutMs) {
        throw new AISDKError({
          name: 'MINIMAX_VIDEO_GENERATION_TIMEOUT',
          message: `MiniMax video generation timed out after ${pollTimeoutMs}ms. Task ID: ${taskId}`,
        });
      }

      const { value: statusResponse, responseHeaders: pollHeaders } =
        await getFromApi({
          url: `${baseURL}/v2/query/video_generation/${taskId}`,
          validateUrl: false,
          headers: combineHeaders(
            await resolve(this.config.headers),
            options.headers,
          ),
          successfulResponseHandler: createJsonResponseHandler(
            minimaxVideoStatusResponseSchema,
          ),
          failedResponseHandler: minimaxVideoFailedResponseHandler,
          abortSignal: options.abortSignal,

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Increase the polling timeout option on the video model / generate call (pollTimeoutMs or the equivalent provider setting) to several minutes.
  2. Raise the surrounding runtime limit (e.g. serverless maxDuration) and avoid wrapping the call in an AbortSignal.timeout shorter than the expected generation time.
  3. Retry the generation if the job is still desirable, or implement job resubmission with backoff on timeout.
  4. Check MiniMax status pages/queue conditions during incidents; switch to a smaller/faster video model.

Example fix

// before
await minimax.videoModel('MiniMax-Hailuo-02').doGenerate({ prompt, pollTimeoutMs: 30_000 });
// after
await minimax.videoModel('MiniMax-Hailuo-02').doGenerate({ prompt, pollTimeoutMs: 600_000 });
Defensive patterns

Strategy: retry

Validate before calling

const expectedMs = 5 * 60_000; // video jobs commonly take minutes
if (abortSignal && (abortSignal as any).reason instanceof DOMException && expectedMs > runtimeBudgetMs) {
  throw new Error('Runtime budget too short for MiniMax video generation');
}

Try / catch

try {
  await minimax.videoModel(modelId).doGenerate({ prompt, pollTimeoutMs: 600_000 });
} catch (e) {
  if (AISDKError.isInstance(e) && e.name === 'MINIMAX_VIDEO_GENERATION_TIMEOUT') {
    // job may still exist server-side: retry once with backoff, or surface task id
    await delay(30_000);
    return retryGeneration();
  }
  throw e;
}

Prevention

When it happens

Trigger: A doGenerate call on MiniMaxVideoModel where the task remains in a non-terminal status beyond the configured polling timeout (long prompts, high queue load, or a small user-supplied pollTimeoutMs / abortSignal timeout).

Common situations: Video models under heavy load taking minutes; tight serverless function timeouts; users setting a short polling timeout expecting seconds-long generation.

Understand the failure class

Related errors


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