lionsoul2014/ip2region · error

no IPv6 searcher available for IPv6 address

Error message

no IPv6 searcher available for IPv6 address

What it means

nginx runtime warning: the request carried a native IPv6 address but no v6_searcher was configured (the ip2region v6 directive/db is absent), so the lookup is skipped and the variable stays unset; configuration is the faulting input, not the address.

Source

Thrown at binding/nginx/src/ngx_http_ip2region_module.c:461

                // 处理纯IPv6地址
                if (ip2region_conf->v6_searcher != NULL) {
                    searcher_ptr = &ip2region_conf->v6_searcher->searcher;
                    bytes_ip_t ip6_bytes[16];
                    if (p != NULL) {
                        memcpy(ip6_bytes, p, 16);
                        err = xdb_search(searcher_ptr, ip6_bytes, 16, &region);
                        if (err == 0) {
                            v->data = (unsigned char *)region.value;
                            v->len = strlen(region.value);
                            xdb_region_buffer_free(&region);
                            return NGX_OK;
                        } else {
                            ngx_log_error(NGX_LOG_WARN, r->connection->log, 0,
                                          "ip2region search failed for IPv6 address");
                        }
                    }
                } else {
                    ngx_log_error(NGX_LOG_WARN, r->connection->log, 0,
                                  "no IPv6 searcher available for IPv6 address");
                }
            }
            break;

#endif

    }
    // 如果搜索失败,释放 region buffer
    xdb_region_buffer_free(&region);

    ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
                  "ip2region: no region found for IP address");
    v->not_found = 1;
    return NGX_OK;
}

View on GitHub (pinned to c1a1fc7d59)

Solutions

  1. Configure the IPv6 searcher via the module's v6 directive and a v6 xdb
  2. Accept unset variables for IPv6 clients if v6 lookup is not required
  3. Guard templates against empty ip2region results
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at binding/nginx/src/ngx_http_ip2region_module.c:461 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/28b03f47953ed06f. Report an issue: GitHub.