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

RedirectURLInvalid

Error message

RedirectURLInvalid

What it means

Sentinel variant of the HTTP client Error enum: a redirect's Location header did not parse into a usable URL (empty, malformed, or not a valid request target). Sibling of RedirectURLTooLong; the client aborts redirect-following with this machine-readable classification.

Solutions

  1. Fix the server to send a valid absolute or relative URL in the Location header
  2. Check for control characters or whitespace in the Location header value
  3. Verify the base URL context for relative redirects is well-defined
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/http/error.rs:70 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/75ba22e503960f50. Report an issue: GitHub.

Appendix: source

Thrown at src/http/error.rs:70

    #[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")]
    HTTP3HeaderEncodingError,
    #[error("DNSResolutionFailed")]

View on GitHub (pinned to 8c5296ac45)