vercel/ai · error · AISDKError

MINIMAX_VIDEO_GENERATION_FAILED

MINIMAX_VIDEO_GENERATION_FAILED

Error message

MiniMax video generation failed${task.error?.message ? `: ${task.error.message}` : ''}${task.error?.code != null ? ` (${task.error.code})` : ''}. Task ID: ${taskId}

What it means

The polled task reached status 'failed' on MiniMax's side; the model surfaces the provider-supplied task.error.message and task.error.code (when present) in an AISDKError named MINIMAX_VIDEO_GENERATION_FAILED, along with the task ID. This is a definitive server-side job failure, not a client timeout.

Source

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

                ...(task.resolution != null
                  ? { resolution: task.resolution }
                  : {}),
                ...(task.usage != null
                  ? {
                      usage: {
                        totalSeconds: task.usage.total_seconds,
                        inputSeconds: task.usage.input_seconds,
                        outputSeconds: task.usage.output_seconds,
                      },
                    }
                  : {}),
              },
            },
          };
        }

        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}`,

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Read the embedded task.error message/code in the thrown error — it states the provider-side cause (content policy, invalid params, internal error) and fix accordingly.
  2. Rephrase the prompt if the failure is content-policy related, or adjust model parameters (resolution, duration) to supported combinations.
  3. Retry the generation, ideally with backoff, if the error code indicates a transient internal failure.
  4. Verify account quota/plan entitlements for the selected video model with MiniMax support using the task ID.

Example fix

// before
await minimax.videoModel('MiniMax-Hailuo-02').doGenerate({ prompt: flaggedPrompt });
// after
await minimax.videoModel('MiniMax-Hailuo-02').doGenerate({ prompt: revisedPrompt }); // e.g. remove policy-violating content
Defensive patterns

Strategy: try-catch

Validate before calling

const disallowed = /policy-pattern/i; // screen prompts against known content-policy triggers before submission
if (disallowed.test(prompt)) throw new Error('Prompt likely rejected by MiniMax content policy');

Try / catch

try {
  await minimax.videoModel(modelId).doGenerate({ prompt });
} catch (e) {
  if (AISDKError.isInstance(e) && e.name === 'MINIMAX_VIDEO_GENERATION_FAILED') {
    // e.message contains task.error.code/message: branch on transient vs permanent causes
    if (isTransient(e.message)) return retryWithBackoff();
  }
  throw e;
}

Prevention

When it happens

Trigger: doGenerate polls a task whose statusResponse.task.status === 'failed'. Causes originate at MiniMax: content-policy rejection of the prompt, invalid parameter combinations, internal rendering failure, or quota/entitlement problems on the account.

Common situations: Prompts violating MiniMax content policies; unsupported resolutions/durations for the chosen model; free-tier limits; transient MiniMax internal errors during peak load.

Related errors


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