vercel/ai · error · AISDKError

MINIMAX_VIDEO_GENERATION_ERROR

MINIMAX_VIDEO_GENERATION_ERROR

Error message

No task_id returned from the MiniMax API. Response: ${JSON.stringify(createResponse)}

What it means

After submitting a video generation job, MiniMaxVideoModel.doGenerate expects the create response to contain a task_id used for polling. If the API response has no task_id, the model cannot track the job and throws AISDKError named MINIMAX_VIDEO_GENERATION_ERROR, embedding the raw response for debugging.

Source

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

    const { value: createResponse } = await postJsonToApi({
      url: `${baseURL}/v2/video_generation`,
      headers: combineHeaders(
        await resolve(this.config.headers),
        options.headers,
      ),
      body,
      failedResponseHandler: minimaxVideoFailedResponseHandler,
      successfulResponseHandler: createJsonResponseHandler(
        minimaxCreateVideoResponseSchema,
      ),
      abortSignal: options.abortSignal,
      fetch: this.config.fetch,
    });

    const taskId = createResponse.task_id;
    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',

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Inspect the JSON response in the error message — it usually contains the real error (auth failure, invalid model, bad parameters) — and fix that cause.
  2. Verify MINIMAX_API_KEY is valid, has video-generation access, and matches the baseURL region (MiniMax API host differs per region).
  3. Confirm you are using a valid MiniMaxVideoModelId (e.g. a video model from the provider's model list) and that the videoBaseURL points at the video API endpoint.
  4. Upgrade @ai-sdk/minimax in case of a response-schema change handled in a newer version.

Example fix

// before
createMiniMax({ apiKey: process.env.MINIMAX_API_KEY }) // video model id: 'abab-video'
// after
createMiniMax({ apiKey: process.env.MINIMAX_API_KEY })
  .videoModel('MiniMax-Hailuo-02'), // valid video model id + correct regional baseURL
Defensive patterns

Strategy: try-catch

Validate before calling

if (!process.env.MINIMAX_API_KEY) throw new Error('MINIMAX_API_KEY is not set');
if (!validMiniMaxVideoModelIds.includes(modelId)) throw new Error(`Unknown MiniMax video model: ${modelId}`);

Try / catch

try {
  await minimax.videoModel(modelId).doGenerate({ prompt, ...options });
} catch (e) {
  if (AISDKError.isInstance(e) && e.name === 'MINIMAX_VIDEO_GENERATION_ERROR' && e.message.includes('No task_id')) {
    // parse e.message JSON to surface the underlying API error (auth/model/params)
  }
  throw e;
}

Prevention

When it happens

Trigger: The POST to the MiniMax video creation endpoint returns 2xx without a task_id — typically an API error payload shaped differently than expected, invalid/unsupported model ID or parameters accepted-but-rejected, wrong baseURL region (e.g. hitting the wrong MiniMax endpoint), or auth quirks returning an error body with a 200 status.

Common situations: Expired or wrong-scoped MINIMAX_API_KEY, using a chat-model id with the video model, MiniMax changing/region-specific response schema, proxy returning an HTML/JSON error page with 200.

Related errors


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