Budibase/budibase · error · Error

Failed to fetch file from URL: ${response.statusText}

Error message

Failed to fetch file from URL: ${response.statusText}

What it means

processUrlFile downloads the user-supplied file URL via fetchWithBlacklist and throws when the response is not OK, surfacing the HTTP statusText. This is the initial fetch path before any upload/fallback logic runs.

Source

Thrown at packages/server/src/automations/steps/ai/extract.ts:146

            MAX_INLINE_DOC_TEXT_LENGTH
          )}`

  return [
    {
      role: "user",
      content: userContent,
    },
  ]
}

async function processUrlFile(
  fileUrl: string,
  fileType: SupportedFileType,
  llm: LLMResponse
): Promise<ExtractInput> {
  const response = await fetchWithBlacklist(fileUrl)
  if (!response.ok) {
    throw new Error(`Failed to fetch file from URL: ${response.statusText}`)
  }

  if (isImageType(fileType)) {
    const data = await response.buffer()
    return { kind: "image", value: toImageDataUrl(data, fileType) }
  }

  const filename = `document.${fileType || "pdf"}`
  try {
    const uploaded = await llm.uploadFile(
      response.body as Readable,
      filename,
      fileType
    )
    return {
      kind: "file",
      value: uploaded,
    }

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Open the URL in a browser/curl to confirm it returns the file with 200
  2. Re-upload the file and use a fresh URL (prefer Budibase attachments) in the step input
  3. If the file requires auth, host it somewhere publicly readable or use attachment source instead
  4. Check for typos or URL-encoding issues in the configured file URL

Example fix

// before
source: URL, fileUrl: "https://example.com/old-report.pdf" // 404
// after
fileUrl: "https://example.com/reports/report-2026.pdf" // 200
Defensive patterns

Strategy: validation

Validate before calling

const pre = await fetchWithBlacklist(fileUrl)
if (!pre.ok) {
  throw new Error(`File URL is not reachable: ${pre.status} ${pre.statusText}`)
}

Try / catch

try {
  const input = await processUrlFile(params, fileUrl, fileType, llm)
} catch (err) {
  if (err.message.startsWith("Failed to fetch file from URL:")) {
    // ask the user for a fresh URL or fall back to attachment upload
  }
  throw err
}

Prevention

When it happens

Trigger: fetchWithBlacklist(fileUrl) returns a non-OK status (404, 403, 410, 5xx) while processing a URL-sourced file in the AI extract automation step.

Common situations: User pasted a wrong or dead link into the extract step; file hosted behind auth or an expired signed URL; SSRF guard passes but server returns an error; server hosting the file is down.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29). Data as JSON: /api/errors/6812dbe4d1ae3a74. Report an issue: GitHub.