{"record":{"id":"1e156b6ec8466161","repo":"vercel/ai","slug":"ai-downloaderror","errorCode":"AI_DownloadError","errorMessage":"Failed to download ${url}: ${statusCode} ${statusText}","messagePattern":"Failed to download (.+?): (.+?) (.+?)","errorType":"http","errorClass":"DownloadError","httpStatus":null,"severity":"error","filePath":"packages/ai/src/util/download/download.ts","lineNumber":49,"sourceCode":"  const urlText = url.toString();\n  try {\n    const headers = withUserAgentSuffix(\n      {},\n      `ai-sdk/${VERSION}`,\n      getRuntimeEnvironmentUserAgent(),\n    );\n\n    const response = await fetchWithValidatedRedirects({\n      url: urlText,\n      headers,\n      abortSignal,\n    });\n\n    if (!response.ok) {\n      // Release the connection before rejecting so an error status from an\n      // attacker-controlled origin cannot leak open sockets.\n      await cancelResponseBody(response);\n      throw new DownloadError({\n        url: urlText,\n        statusCode: response.status,\n        statusText: response.statusText,\n      });\n    }\n\n    const data = await readResponseWithSizeLimit({\n      response,\n      url: urlText,\n      maxBytes: maxBytes ?? DEFAULT_MAX_DOWNLOAD_SIZE,\n    });\n\n    return {\n      data,\n      mediaType: response.headers.get('content-type') ?? undefined,\n    };\n  } catch (error) {\n    if (DownloadError.isInstance(error)) {","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/ai/src/util/download/download.ts#L31-L67","documentation":"Error \"Failed to download ${url}: ${statusCode} ${statusText}\" thrown in vercel/ai.","triggerScenarios":"Thrown at packages/ai/src/util/download/download.ts:49 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}