lionsoul2014/ip2region · error

ip2region: no region found for IP address

Error message

ip2region: no region found for IP address

What it means

nginx end-of-variable info log: after the search path completes (whether or not a region was found) the module frees the region buffer and emits this informational message — it fires for every evaluated request when no region data was produced, e.g. empty search result or skipped lookup, not only on hard errors.

Solutions

  1. Raise the log level above info to silence per-request noise
  2. Treat an empty variable as 'unknown region' in your templates
  3. Investigate repeated no-region results only if valid public IPs are affected
Defensive patterns

Strategy: fallback

When it happens

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

Appendix: source

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

                        } 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;
}


static void
ngx_http_ip2region_cleanup(void *data)
{
    ngx_http_ip2region_conf_t *ip2region_conf = data;

    // 清理 IPv4 searcher
    if(ip2region_conf->v4_searcher != NULL) {
        xdb_close(&ip2region_conf->v4_searcher->searcher);

        // check and free the vector index
        if (ip2region_conf->v4_searcher->v_index != NULL) {
            xdb_free_vector_index((void *)ip2region_conf->v4_searcher->v_index);

View on GitHub (pinned to c1a1fc7d59)