lionsoul2014/ip2region · error · Error

invalid ipv6 address: multi double colon detected

Error message

invalid ipv6 address: multi double colon detected

What it means

IPv6 parser guard: RFC 4291 allows at most one '::' zero-run abbreviation per address; the input contained two or more empty groups (e.g. '1::2::3'), so the expansion of the elided zeros would be ambiguous.

Source

Thrown at binding/javascript/util.js:91

}

// parse ipv6 address
function _parse_ipv6_addr(v6String) {
    let ps = v6String.split(':', 8);
    if (ps.length < 3) {
        throw new Error('invalid ipv6 address');
    }

    let dc_num = 0, offset = 0;
    const ipBytes = Buffer.alloc(16);
    for (var i = 0; i < ps.length; i++) {
        let s = ps[i].trim();

        // Double colon check and auto padding
        if (s.length == 0) {
            // ONLY one double colon allow
            if (dc_num > 0) {
                throw new Error('invalid ipv6 address: multi double colon detected');
            }

            let start = i, mi = ps.length - 1;
            // clear all the consecutive spaces
            for (i++;;) {
                s = ps[i].trim();
                if (s.length > 0) {
                    i--;
                    break;
                }

                if (i >= mi) {
                    break;
                }

                i++;
            }

View on GitHub (pinned to c1a1fc7d59)

Solutions

  1. Write the address with only one '::', or expand all groups explicitly (eight groups, no double colon)
  2. Fix the likely typo that produced a second empty group
  3. Pre-validate the address with net.isIPv6 before search
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at binding/javascript/util.js:91 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of lionsoul2014/ip2region@c1a1fc7d59 (2026-09-02). Data as JSON: /api/errors/ca5cd5978c07c27c. Report an issue: GitHub.