vercel/ai · error · DownloadError

AI_DownloadError

AI_DownloadError

Error message

Failed to download ${url}: ${statusCode} ${statusText}

What it means

Error "Failed to download ${url}: ${statusCode} ${statusText}" thrown in vercel/ai.

Source

Thrown at packages/ai/src/util/download/download.ts:49

  const urlText = url.toString();
  try {
    const headers = withUserAgentSuffix(
      {},
      `ai-sdk/${VERSION}`,
      getRuntimeEnvironmentUserAgent(),
    );

    const response = await fetchWithValidatedRedirects({
      url: urlText,
      headers,
      abortSignal,
    });

    if (!response.ok) {
      // Release the connection before rejecting so an error status from an
      // attacker-controlled origin cannot leak open sockets.
      await cancelResponseBody(response);
      throw new DownloadError({
        url: urlText,
        statusCode: response.status,
        statusText: response.statusText,
      });
    }

    const data = await readResponseWithSizeLimit({
      response,
      url: urlText,
      maxBytes: maxBytes ?? DEFAULT_MAX_DOWNLOAD_SIZE,
    });

    return {
      data,
      mediaType: response.headers.get('content-type') ?? undefined,
    };
  } catch (error) {
    if (DownloadError.isInstance(error)) {

View on GitHub (pinned to 69428b1f8b)

When it happens

Trigger: Thrown at packages/ai/src/util/download/download.ts:49 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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