oven-sh/bun · error · TypeError

FailedToOpenSocket

FailedToOpenSocket

Error message

FailedToOpenSocket

What it means

The socket could not be opened for the outgoing connection. Fires when socket(), bind(), or connect() syscalls fail — due to fd exhaustion, address family unavailability, or permission errors — before any network I/O begins.

Solutions

  1. Check the system file descriptor limit (ulimit -n) and raise it if exhausted
  2. Verify the address family (IPv4/IPv6) is available and configured on the host
  3. Check for socket permission issues (e.g., binding to privileged ports)
Defensive patterns

Strategy: retry

When it happens

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

Appendix: source

Thrown at src/http/error.rs:94

    #[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)]
    Zlib(bun_zlib::ZlibError),
    #[error(transparent)]

View on GitHub (pinned to 8c5296ac45)