zeroclaw-labs/zeroclaw · error

prefix length /{len} is not one of the RFC 6052 lengths /32,

Error message

prefix length /{len} is not one of the RFC 6052 lengths /32, /40, /48, /56, /64, /96

What it means

Error "prefix length /{len} is not one of the RFC 6052 lengths /32, /40, /48, /56, /64, /96" thrown in zeroclaw-labs/zeroclaw.

Source

Thrown at crates/zeroclaw-infra/src/net_guard.rs:628

    pub fn parse(raw: &str) -> anyhow::Result<Self> {
        let entry = raw.trim();
        if entry.is_empty() {
            anyhow::bail!("NAT64 prefix is empty");
        }

        let (address, length) = entry
            .split_once('/')
            .ok_or_else(|| anyhow::Error::msg("missing '/<prefix-length>'"))?;

        let network = address
            .parse::<std::net::Ipv6Addr>()
            .map_err(|e| anyhow::Error::msg(format!("'{address}' is not an IPv6 address: {e}")))?;
        let len = length
            .parse::<u8>()
            .map_err(|e| anyhow::Error::msg(format!("'{length}' is not a prefix length: {e}")))?;

        if !RFC6052_PREFIX_LENGTHS.contains(&len) {
            anyhow::bail!(
                "prefix length /{len} is not one of the RFC 6052 lengths /32, /40, /48, /56, /64, /96"
            );
        }

        // `len` is at most 96 here, so the shift is always in range.
        let host_bits = u128::MAX >> len;
        if u128::from_be_bytes(network.octets()) & host_bits != 0 {
            anyhow::bail!("address '{address}' sets bits beyond /{len}");
        }

        Ok(Self { network, len })
    }

    /// The prefix length in bits.
    #[must_use]
    pub const fn prefix_len(&self) -> u8 {
        self.len
    }

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Use one of the RFC 6052 prefix lengths: /32, /40, /48, /56, /64, or /96.

When it happens

Trigger: Thrown at crates/zeroclaw-infra/src/net_guard.rs:628 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/7a41f0d3cace5058. Report an issue: GitHub.