zed-industries/zed · error · anyhow::Error

DAP returned IPv6 host {addr}, which the v0.6.0 extension AP

Error message

DAP returned IPv6 host {addr}, which the v0.6.0 extension API cannot represent; the extension must be updated to v0.8.0 or later

What it means

Thrown when converting a debug adapter's TCP connection arguments from the current (latest) internal representation down to the v0.6.0 WIT type. The v0.6.0 dap::TcpArguments stores the host as a single u64 (IPv4 bits), so an IPv6 address — which the latest type represents as an IpAddress::Ipv6 variant — cannot round-trip. The host bails with a message telling the author the extension must target v0.8.0 or later, where TcpArguments carries the full IpAddress enum.

Source

Thrown at crates/extension_host/src/wasm_host/wit/since_v0_6_0.rs:434

        Self {
            host: latest::dap::IpAddress::Ipv4((a, b, c, d)),
            port: value.port,
            timeout: value.timeout,
        }
    }
}

impl TryFrom<latest::dap::TcpArguments> for dap::TcpArguments {
    type Error = anyhow::Error;

    fn try_from(value: latest::dap::TcpArguments) -> Result<Self> {
        let host = match value.host {
            latest::dap::IpAddress::Ipv4((a, b, c, d)) => {
                std::net::Ipv4Addr::new(a, b, c, d).to_bits()
            }
            latest::dap::IpAddress::Ipv6((a, b, c, d, e, f, g, h)) => {
                let addr = std::net::Ipv6Addr::new(a, b, c, d, e, f, g, h);
                anyhow::bail!(
                    "DAP returned IPv6 host {addr}, which the v0.6.0 extension API cannot represent; the extension must be updated to v0.8.0 or later"
                );
            }
        };
        Ok(Self {
            host,
            port: value.port,
            timeout: value.timeout,
        })
    }
}

impl From<dap::TcpArgumentsTemplate> for latest::dap::TcpArgumentsTemplate {
    fn from(value: dap::TcpArgumentsTemplate) -> Self {
        Self {
            host: value.host.map(|host| {
                let [a, b, c, d] = std::net::Ipv4Addr::from_bits(host).octets();
                latest::dap::IpAddress::Ipv4((a, b, c, d))

View on GitHub (pinned to f4178619ac)

Solutions

  1. Update the extension: set extension_api_version to "0.8.0"+ (e.g. "1") so the host passes IpAddress through unchanged
  2. Configure the debug adapter to use an IPv4 host (127.0.0.1) if the extension cannot be upgraded
  3. If you maintain the adapter, default to 127.0.0.1 instead of ::/::1 when both stacks are available

Example fix

# before (extension.toml)
extension_api_version = "0.6.0"
# adapter returns host ::1 -> bail: DAP returned IPv6 host ...

# after
extension_api_version = "1"
# v0.8.0+ TcpArguments.host is IpAddress, IPv6 passes through
Defensive patterns

Strategy: validation

Validate before calling

// before converting latest DAP TCP args for an old-API extension
if matches!(tcp_args.host, latest::dap::IpAddress::Ipv6(_)) {
    // cannot be represented on v0.6.0: require a newer extension instead of failing at conversion
    return Err("extension must target API v0.8.0+ for IPv6 debug adapters".into());
}

Type guard

fn is_representable_on_v0_6_0(host: &latest::dap::IpAddress) -> bool {
    matches!(host, latest::dap::IpAddress::Ipv4(_))
}

Try / catch

let tcp = match dap::TcpArguments::try_from(latest_tcp_args) {
    Ok(args) => args,
    Err(e) if e.to_string().contains("IPv6") => { /* prompt extension update / use 127.0.0.1 */ return Ok(()); }
    Err(e) => return Err(e),
};

Prevention

When it happens

Trigger: A debug adapter (via latest::dap) returns host = IpAddress::Ipv6((...)) — e.g. "::1" or "::" — while the extension declares extension API v0.6.x/v0.7.x, forcing the TryFrom<latest::dap::TcpArguments> for dap::TcpArguments downconversion.

Common situations: A DAP server that listens on IPv6 localhost (common on Windows and on systems where localhost resolves to ::1), run under an extension pinned to an older extension_api_version.

Related errors


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/023a9cf757538875. Report an issue: GitHub.