Budibase/budibase · error

Unexpected response ${response.statusText}

Error message

Unexpected response ${response.statusText}

What it means

processUrlAttachment downloads a remote attachment for an automation via fetchWithBlacklist and requires both an OK (2xx) status and a non-null body. If either fails, it throws 'Unexpected response <statusText>'. This is the automation attachment ingestion path.

Source

Thrown at packages/backend-core/src/objectStore/utils.ts:73

      Days: days,
    },
  }
  const lifecycleConfiguration = {
    Rules: [lifecycleRule],
  }

  return {
    Bucket: bucketName,
    LifecycleConfiguration: lifecycleConfiguration,
  }
}

async function processUrlAttachment(
  attachment: AutomationAttachment
): Promise<AutomationAttachmentContent> {
  const response = await fetchWithBlacklist(attachment.url)
  if (!response.ok || !response.body) {
    throw new Error(`Unexpected response ${response.statusText}`)
  }
  const fallbackFilename = path.basename(new URL(attachment.url).pathname)
  if (!response.body) {
    throw new Error("No response received for attachment")
  }
  if (!(response.body instanceof stream.Readable)) {
    throw new Error("Unexpected response body stream type")
  }
  return {
    filename: attachment.filename || fallbackFilename,
    content: response.body,
  }
}

export async function processObjectStoreAttachment(
  attachment: AutomationAttachment
): Promise<BucketedContent> {
  const result = objectStore.extractBucketAndPath(attachment.url)

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Verify the attachment URL works with curl -I from the server; fix or regenerate the URL if it returns 404/410
  2. Handle expired signed URLs — re-generate the link or re-upload the file before the automation runs
  3. 403: the remote may block non-browser clients; host the file somewhere fetchable or add a proxy with proper headers
  4. Check fetchWithBlacklist isn't rejecting the host via configured blacklist

Example fix

// before
attachment.url = "https://example.com/file.pdf" // possibly expired signed URL
// after
// ensure URL is fresh/valid before building the automation attachment
const res = await fetch(url, { method: "HEAD" })
if (res.ok) attachment.url = url
Defensive patterns

Strategy: validation

Validate before calling

const res = await fetch(url, { method: "HEAD" })
if (!res.ok) throw new Error(`Attachment URL invalid: ${res.status}`)

Try / catch

try {
  const content = await processAutomationAttachment(attachment)
} catch (err) {
  if (err.message.startsWith("Unexpected response")) {
    // regenerate or replace the attachment URL
  }
  throw err
}

Prevention

When it happens

Trigger: An automation attachment step whose attachment.url returns 404/403/500 or redirects to an error page, or a response whose body is missing (e.g. 204 or a HEAD-like response).

Common situations: Automations referencing signed URLs that expired, links to files moved/deleted from external servers, or target sites blocking server-side fetches (bot protection returning 403).

Related errors


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