Budibase/budibase · warning
Maximum redirect reached.
Error message
Maximum redirect reached.
What it means
When a redirect response (3xx) arrives without a Location header, the library cannot compute the next URL. Unless the caller opted into returnRedirectWithoutLocation, it throws this (misleadingly named) error, since a redirect it cannot follow was received.
Source
Thrown at packages/backend-core/src/utils/outboundFetch.ts:236
return response
}
releaseResponseBody(response)
if (!followRedirects) {
throw new Error("Redirects are not permitted.")
}
if (redirects === MAX_REDIRECTS) {
break
}
const location = response.headers.get("location")
if (!location) {
if (returnRedirectWithoutLocation) {
return response
}
throw new Error("Maximum redirect reached.")
}
const redirectUrl = parseUrl(
new URL(location, nextUrl).toString()
).toString()
nextRequest = nextRequestForRedirect(nextRequest, response.status)
if (shouldStripSensitiveHeadersForRedirect(nextUrl, redirectUrl)) {
if (rejectCrossOriginRedirects) {
throw new Error("Redirect to a different origin is not permitted.")
}
nextRequest = stripSensitiveHeadersForRedirect(nextRequest)
}
nextUrl = redirectUrl
}
throw new Error("Maximum redirect reached.")
}
View on GitHub (pinned to a81a902e9a)
Solutions
- Pass { returnRedirectWithoutLocation: true } if your code can tolerate/handle malformed redirects.
- Inspect the offending server's 3xx response (curl -i) and fix it server-side to include Location.
- Verify the custom fetchFn returns a faithful Response whose headers include Location.
Example fix
// before
await fetchWithBlacklist(url)
// after
await fetchWithBlacklist(url, {}, { returnRedirectWithoutLocation: true }) Defensive patterns
Strategy: try-catch
Try / catch
try {
return await fetchWithBlacklist(url, req)
} catch (err) {
if (err instanceof Error && err.message === "Maximum redirect reached.") {
// a 3xx without Location was received — retry tolerating malformed redirects
return fetchWithBlacklist(url, req, { returnRedirectWithoutLocation: true })
}
throw err
} Prevention
- Set returnRedirectWithoutLocation: true when fetching third-party endpoints you don't control.
- Report bare-3xx servers to their owners; they are protocol violations.
- Sanity-check custom fetchFn responses preserve headers.
When it happens
Trigger: Server returns 301/302/303/307/308 with no Location header, followRedirects is true, returnRedirectWithoutLocation is false (default), and the redirect budget hasn't been exhausted (redirects !== MAX_REDIRECTS at the break).
Common situations: Misconfigured or broken remote servers emitting bare 3xx responses; middleware/proxies that strip the Location header; custom fetchFn returning hand-crafted response objects lacking headers.get("location").
Related errors
- Redirects are not permitted.
- Redirect to a different origin is not permitted.
- Failed to download asset: ${response.statusText}
- Failed to fetch file from URL: ${response.statusText}
- Failed to fetch file from URL: ${fallbackResponse.statusText
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/1c554f437ee15057.
Report an issue: GitHub.