lionsoul2014/ip2region · error
ip verison not match: xdb file %s with ip version=%s, as %s
Error message
ip verison not match: xdb file %s with ip version=%s, as %s expected
What it means
Go service config guard: the IP version declared in the xdb header does not match the version the config was created for (e.g. passing an IPv6 database to NewV4Config). Both the file's version and the expected one are reported.
Source
Thrown at binding/golang/service/config.go:94
err = xdb.Verify(handle)
if err != nil {
return nil, err
}
// 2, load the header
header, err := xdb.LoadHeader(handle)
if err != nil {
return nil, err
}
// verify the ip version
xIpVersion, err := xdb.VersionFromHeader(header)
if err != nil {
return nil, err
}
if xIpVersion.Id != ipVersion.Id {
return nil, fmt.Errorf("ip verison not match: xdb file %s with ip version=%s, as %s expected", xdbPath, xIpVersion.Name, ipVersion.Name)
}
// 3, check and load the vector index buffer
var vIndex []byte = nil
if cachePolicy == VIndexCache {
vIndex, err = xdb.LoadVectorIndex(handle)
if err != nil {
return nil, err
}
}
// 4, check and load the content buffer
var cBuffer []byte = nil
if cachePolicy == BufferCache {
cBuffer, err = xdb.LoadContent(handle)
if err != nil {
return nil, err
}View on GitHub (pinned to c1a1fc7d59)
Solutions
- Use NewV4Config with an IPv4 xdb and NewV6Config with an IPv6 xdb
- Check that the correct db file path is configured for each family
- Auto-detect the version via VersionFromHeader when the file's family is unknown
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at binding/golang/service/config.go:94 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/2fbb437ccf8c219a.
Report an issue: GitHub.