{"record":{"id":"bd756b50d803a975","repo":"vercel/ai","slug":"minimax-video-generation-timeout","errorCode":"MINIMAX_VIDEO_GENERATION_TIMEOUT","errorMessage":"MiniMax video generation timed out after ${pollTimeoutMs}ms. Task ID: ${taskId}","messagePattern":"MiniMax video generation timed out after (.+?)ms\\. Task ID: (.+?)","errorType":"exception","errorClass":"AISDKError","httpStatus":null,"severity":"error","filePath":"packages/minimax/src/minimax-video-model.ts","lineNumber":583,"sourceCode":"    if (!taskId) {\n      throw new AISDKError({\n        name: 'MINIMAX_VIDEO_GENERATION_ERROR',\n        message: `No task_id returned from the MiniMax API. Response: ${JSON.stringify(createResponse)}`,\n      });\n    }\n\n    const pollIntervalMs =\n      minimaxOptions?.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;\n    const pollTimeoutMs =\n      minimaxOptions?.pollTimeoutMs ?? DEFAULT_POLL_TIMEOUT_MS;\n    const startTime = Date.now();\n    let responseHeaders: Record<string, string> | undefined;\n\n    while (true) {\n      await delay(pollIntervalMs, { abortSignal: options.abortSignal });\n\n      if (Date.now() - startTime > pollTimeoutMs) {\n        throw new AISDKError({\n          name: 'MINIMAX_VIDEO_GENERATION_TIMEOUT',\n          message: `MiniMax video generation timed out after ${pollTimeoutMs}ms. Task ID: ${taskId}`,\n        });\n      }\n\n      const { value: statusResponse, responseHeaders: pollHeaders } =\n        await getFromApi({\n          url: `${baseURL}/v2/query/video_generation/${taskId}`,\n          validateUrl: false,\n          headers: combineHeaders(\n            await resolve(this.config.headers),\n            options.headers,\n          ),\n          successfulResponseHandler: createJsonResponseHandler(\n            minimaxVideoStatusResponseSchema,\n          ),\n          failedResponseHandler: minimaxVideoFailedResponseHandler,\n          abortSignal: options.abortSignal,","sourceCodeStart":565,"sourceCodeEnd":601,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/minimax/src/minimax-video-model.ts#L565-L601","documentation":"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.","triggerScenarios":"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).","commonSituations":"Video models under heavy load taking minutes; tight serverless function timeouts; users setting a short polling timeout expecting seconds-long generation.","solutions":["Increase the polling timeout option on the video model / generate call (pollTimeoutMs or the equivalent provider setting) to several minutes.","Raise the surrounding runtime limit (e.g. serverless maxDuration) and avoid wrapping the call in an AbortSignal.timeout shorter than the expected generation time.","Retry the generation if the job is still desirable, or implement job resubmission with backoff on timeout.","Check MiniMax status pages/queue conditions during incidents; switch to a smaller/faster video model."],"exampleFix":"// before\nawait minimax.videoModel('MiniMax-Hailuo-02').doGenerate({ prompt, pollTimeoutMs: 30_000 });\n// after\nawait minimax.videoModel('MiniMax-Hailuo-02').doGenerate({ prompt, pollTimeoutMs: 600_000 });","handlingStrategy":"retry","validationCode":"const expectedMs = 5 * 60_000; // video jobs commonly take minutes\nif (abortSignal && (abortSignal as any).reason instanceof DOMException && expectedMs > runtimeBudgetMs) {\n  throw new Error('Runtime budget too short for MiniMax video generation');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await minimax.videoModel(modelId).doGenerate({ prompt, pollTimeoutMs: 600_000 });\n} catch (e) {\n  if (AISDKError.isInstance(e) && e.name === 'MINIMAX_VIDEO_GENERATION_TIMEOUT') {\n    // job may still exist server-side: retry once with backoff, or surface task id\n    await delay(30_000);\n    return retryGeneration();\n  }\n  throw e;\n}","preventionTips":["Set pollTimeoutMs generously (5-10 minutes) for video generation","Match serverless function timeouts to the polling budget","Avoid AbortSignal.timeout values shorter than expected generation time","Persist the task ID so long jobs can be re-polled or resubmitted"],"tags":["minimax","video-generation","timeout","polling"],"backgroundTag":"async-job-timeout","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}