oven-sh/bun · error · bun_http::Error

RedirectURLTooLong

Error message

RedirectURLTooLong

What it means

Sentinel variant of the HTTP client Error enum: while following a redirect, the Location header contained a URL longer than the client's fixed limit for redirect targets. The redirect cannot be followed safely (the target may be malicious or malformed), so the request fails with this variant.

Solutions

  1. Fix the server to issue shorter redirect URLs
  2. Check for redirect chains that append query parameters on each hop, growing the URL
  3. Increase the configured maximum URL length if legitimate URLs are long
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/http/error.rs:68 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16). Data as JSON: /api/errors/0240cfc51e17ecd9. Report an issue: GitHub.

Appendix: source

Thrown at src/http/error.rs:68

    #[error("HTTP3Unsupported")]
    HTTP3Unsupported,
    #[error("ResponseHeadersTooLarge")]
    ResponseHeadersTooLarge,
    #[error("UnrequestedUpgrade")]
    UnrequestedUpgrade,
    #[error("UnexpectedData")]
    UnexpectedData,
    #[error("InvalidHTTPResponse")]
    InvalidHTTPResponse,
    #[error("InvalidContentLength")]
    InvalidContentLength,
    #[error("UnsupportedTransferEncoding")]
    UnsupportedTransferEncoding,
    #[error("RequestBodyNotReusable")]
    RequestBodyNotReusable,
    #[error("UnsupportedRedirectProtocol")]
    UnsupportedRedirectProtocol,
    #[error("RedirectURLTooLong")]
    RedirectURLTooLong,
    #[error("RedirectURLInvalid")]
    RedirectURLInvalid,
    #[error("InvalidRedirectURL")]
    InvalidRedirectURL,
    #[error("UnexpectedRedirect")]
    UnexpectedRedirect,
    #[error("ShortRead")]
    ShortRead,
    #[error("WantRead")]
    WantRead,
    #[error("WantWrite")]
    WantWrite,
    #[error("HTTP3HandshakeFailed")]
    HTTP3HandshakeFailed,
    #[error("HTTP3ProtocolError")]
    HTTP3ProtocolError,
    #[error("HTTP3HeaderEncodingError")]

View on GitHub (pinned to 8c5296ac45)