quickwit-oss/quickwit · info

IP range should parse

Error message

IP range should parse

What it means

is_forwardable_ip lazily builds a static list of non-forwardable CIDR networks (loopback, unspecified, link-local, etc.) by parsing hardcoded string literals with `network.parse::<IpNetwork>()`. The literals are compile-time constants known to be valid, so the expect "IP range should parse" documents an internal invariant; a panic here is a bug (e.g. typo introduced while editing the list), not user input being rejected.

Source

Thrown at quickwit/quickwit-common/src/net.rs:298

        [
            "0.0.0.0/8",
            "127.0.0.0/8",
            "169.254.0.0/16",
            "192.0.0.0/24",
            "192.0.2.0/24",
            "198.51.100.0/24",
            "2001:10::/28",
            "2001:db8::/32",
            "203.0.113.0/24",
            "240.0.0.0/4",
            "255.255.255.255/32",
            "::/128",
            "::1/128",
            "::ffff:0:0/96",
            "fe80::/10",
        ]
        .iter()
        .map(|network| network.parse().expect("IP range should parse"))
        .collect()
    });
    NON_FORWARDABLE_NETWORKS
        .iter()
        .all(|network| !network.contains(*ip_addr))
}

fn is_private_ip(ip_addr: &IpAddr) -> bool {
    static PRIVATE_NETWORKS: LazyLock<Vec<IpNetwork>> = LazyLock::new(|| {
        ["192.168.0.0/16", "172.16.0.0/12", "10.0.0.0/8", "fc00::/7"]
            .iter()
            .map(|network| network.parse().expect("IP range should parse"))
            .collect()
    });
    PRIVATE_NETWORKS
        .iter()
        .any(|network| network.contains(*ip_addr))
}

View on GitHub (pinned to a39730c5cd)

Solutions

  1. Check the most recently edited network literal for typos (missing prefix like "::1/128" becoming "::1").
  2. Verify the ipnetwork crate version still parses the given literals (dependency bump regression).
  3. Keep the expect as-is: it is an intentional compile-data invariant, not a runtime condition.

Example fix

// before (typo)
"fe80:/10",
// after
"fe80::/10",
Defensive patterns

Strategy: validation

Validate before calling

"fe80::/10".parse::<ipnetwork::IpNetwork>().expect("literal must be valid CIDR") // verified at test time

Prevention

When it happens

Trigger: Only when the hardcoded CIDR literal array is edited to an invalid value (or the IpNetwork parser changes semantics), making parse() fail on first access of the LazyLock.

Common situations: Practically never hit by users; seen by developers refactoring net.rs or swapping the ipnetwork crate version with stricter parsing.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of quickwit-oss/quickwit@a39730c5cd (2026-09-08). Data as JSON: /api/errors/737e8aaf8200ec4e. Report an issue: GitHub.