vercel/ai · error · AISDKError

GOOGLE_VIDEO_GENERATION_ERROR

GOOGLE_VIDEO_GENERATION_ERROR

Error message

No videos in response. Response: ${JSON.stringify(finalOperation)}

What it means

When a Google Veo video generation operation reaches a completed state but its response contains no generateVideoResponse.generatedSamples, buildCompletedResult throws GOOGLE_VIDEO_GENERATION_ERROR with the full serialized operation for debugging. It indicates the API reported completion without producing any video samples.

Source

Thrown at packages/google/src/google-video-model.ts:288

    warnings: SharedV4Warning[],
    currentDate: Date,
  ): Promise<{
    status: 'completed';
    videos: Array<{ type: 'url'; url: string; mediaType: string }>;
    warnings: SharedV4Warning[];
    providerMetadata: SharedV4ProviderMetadata;
    response: {
      timestamp: Date;
      modelId: string;
      headers: Record<string, string> | undefined;
    };
  }> {
    const response = finalOperation.response;
    if (
      !response?.generateVideoResponse?.generatedSamples ||
      response.generateVideoResponse.generatedSamples.length === 0
    ) {
      throw new AISDKError({
        name: 'GOOGLE_VIDEO_GENERATION_ERROR',
        message: `No videos in response. Response: ${JSON.stringify(finalOperation)}`,
      });
    }

    const videos: Array<{ type: 'url'; url: string; mediaType: string }> = [];
    const videoMetadata: Array<{ uri: string }> = [];

    // Get API key from headers to append to download URLs
    const resolvedHeaders = await resolve(this.config.headers);
    const apiKey = resolvedHeaders?.['x-goog-api-key'];

    for (const generatedSample of response.generateVideoResponse
      .generatedSamples) {
      if (generatedSample.video?.uri) {
        // Append the API key to the download URL for authentication, but only
        // when the response-supplied URI stays on the provider's own origin —
        // otherwise the key would leak to whatever host the response names.

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Inspect the JSON in the error message for failure reasons (e.g. safety/filtered flags) and adjust the prompt
  2. Check the operation's error/filtered fields returned by the Veo API and surface them to the user
  3. Update @ai-sdk/google in case the Veo response schema handling changed
  4. Retry generation with a modified prompt or different model/settings
Defensive patterns

Strategy: try-catch

Validate before calling

// after polling, before consuming results:
const op = /* completed operation */;
if (!op.response?.generateVideoResponse?.generatedSamples?.length) {
  // handle 'no samples' case: check filtered/RAI reasons, retry with new prompt
}

Type guard

function hasGeneratedSamples(op: unknown): op is { response: { generateVideoResponse: { generatedSamples: unknown[] } } } {
  return !!(op as any)?.response?.generateVideoResponse?.generatedSamples?.length;
}

Try / catch

try {
  const result = await generateVideo({ model: google.videoModel('veo-...'), prompt });
} catch (error) {
  if (AISDKError.isInstance(error) && error.name === 'GOOGLE_VIDEO_GENERATION_ERROR') {
    // inspect error.message JSON for failure reasons; adjust prompt or retry
  }
  throw error;
}

Prevention

When it happens

Trigger: Polling a Veo video operation via doStatus where the completed operation's response lacks generatedSamples or has an empty array — e.g. generation rejected/filtered server-side or an unexpected API response shape.

Common situations: Prompt blocked by safety filters so no samples are returned; API response schema changes from Google; model returns status=done with no output.

Related errors


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