oven-sh/bun · error · TypeError

HTTP3ContentLengthMismatch

HTTP3ContentLengthMismatch

Error message

HTTP3ContentLengthMismatch

What it means

The HTTP/3 response body length does not match the declared Content-Length. Fires when the QUIC stream delivers more or fewer bytes than the Content-Length header indicated, violating HTTP/3 message framing rules.

Solutions

  1. Verify the server sends an accurate Content-Length for HTTP/3 responses
  2. Check for QUIC stream truncation or premature FIN signals
  3. Use chunked framing instead of fixed Content-Length for dynamic responses
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/http/error.rs:92 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/25fbc1b059168f03. Report an issue: GitHub.

Appendix: source

Thrown at src/http/error.rs:92

    #[error("UnexpectedRedirect")]
    UnexpectedRedirect,
    #[error("ShortRead")]
    ShortRead,
    #[error("WantRead")]
    WantRead,
    #[error("WantWrite")]
    WantWrite,
    #[error("HTTP3HandshakeFailed")]
    HTTP3HandshakeFailed,
    #[error("HTTP3ProtocolError")]
    HTTP3ProtocolError,
    #[error("HTTP3HeaderEncodingError")]
    HTTP3HeaderEncodingError,
    #[error("DNSResolutionFailed")]
    DNSResolutionFailed,
    #[error("HTTP3StreamReset")]
    HTTP3StreamReset,
    #[error("HTTP3ContentLengthMismatch")]
    HTTP3ContentLengthMismatch,
    #[error("FailedToOpenSocket")]
    FailedToOpenSocket,
    #[error("InvalidCRL")]
    InvalidCRL,
    #[error("UnsupportedProxyProtocol")]
    UnsupportedProxyProtocol,
    #[error(transparent)]
    Cert(#[from] CertError),
    #[error(transparent)]
    Alloc(#[from] bun_alloc::AllocError),
    #[error(transparent)]
    Hpack(#[from] crate::lshpack::HpackError),
    #[error(transparent)]
    Core(#[from] bun_core::Error),
    #[error(transparent)]
    Sys(#[from] bun_errno::SystemErrno),
    #[error(transparent)]

View on GitHub (pinned to 8c5296ac45)