cloudflare/quiche · error

unable to parse bind address

Error message

unable to parse bind address

What it means

resolve_socket_addrs builds a bind address string (0.0.0.0 or [::] plus --source-port) and panics via expect if it fails to parse as a SocketAddr. This only fails if the constructed string is malformed, which in practice means an invalid --source-port value.

Solutions

  1. Pass a valid port number between 0 and 65535 for --source-port.
  2. Omit --source-port to use an ephemeral port.
  3. Validate the port in wrapper scripts before invoking h3i.

Example fix

// before
h3i --host_port example.com:443 --source-port 70000
// after
h3i --host_port example.com:443 --source-port 51000
Defensive patterns

Strategy: validation

Validate before calling

let port: u16 = source_port.parse()
    .map_err(|_| "--source-port must be 0-65535")?;

Prevention

When it happens

Trigger: Passing a non-numeric or out-of-range --source-port (e.g. >65535 or empty) so the composed bind string fails SocketAddr parsing.

Common situations: Scripting h3i with an unvalidated port variable; typos like --source-port 99999.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of cloudflare/quiche@9f96daa2c2 (2026-09-08). Data as JSON: /api/errors/8aee75d83b3799a4. Report an issue: GitHub.

Appendix: source

Thrown at h3i/src/client/mod.rs:595

        *url::Url::parse(&x)
            .unwrap()
            .socket_addrs(|| None)
            .unwrap()
            .first()
            .unwrap()
    };

    // Bind to INADDR_ANY or IN6ADDR_ANY depending on the IP family of the
    // server address. This is needed on macOS and BSD variants that don't
    // support binding to IN6ADDR_ANY for both v4 and v6.
    let bind_addr = match peer_addr {
        std::net::SocketAddr::V4(_) => format!("0.0.0.0:{}", args.source_port),
        std::net::SocketAddr::V6(_) => format!("[::]:{}", args.source_port),
    };

    (
        peer_addr,
        bind_addr.parse().expect("unable to parse bind address"),
    )
}

View on GitHub (pinned to 9f96daa2c2)