lionsoul2014/ip2region · error

searchers=%d, > 0 expected

Error message

searchers=%d, > 0 expected

What it means

Go service config guard: newConfig rejects a searchers count < 1 because at least one underlying xdb.Searcher must be created for the pool; a zero/negative pool size is meaningless.

Source

Thrown at binding/golang/service/config.go:65

	// buffers
	vIndex  []byte
	cBuffer []byte

	searchers int
}

func NewV4Config(cachePolicy int, xdbPath string, searchers int) (*Config, error) {
	return newConfig(cachePolicy, xdb.IPv4, xdbPath, searchers)
}

func NewV6Config(cachePolicy int, xdbPath string, searchers int) (*Config, error) {
	return newConfig(cachePolicy, xdb.IPv6, xdbPath, searchers)
}

func newConfig(cachePolicy int, ipVersion *xdb.Version, xdbPath string, searchers int) (*Config, error) {
	if searchers < 1 {
		return nil, fmt.Errorf("searchers=%d, > 0 expected", searchers)
	}

	// open the xdb binary file
	handle, err := os.OpenFile(xdbPath, os.O_RDONLY, 0600)
	if err != nil {
		return nil, err
	}
	defer handle.Close()

	// 1, verify the xdb
	err = xdb.Verify(handle)
	if err != nil {
		return nil, err
	}

	// 2, load the header
	header, err := xdb.LoadHeader(handle)
	if err != nil {

View on GitHub (pinned to c1a1fc7d59)

Solutions

  1. Pass a searchers value >= 1 (e.g. 20 as used by the defaults)
  2. Validate pool size in your configuration before building the service
  3. Use NewIp2RegionWithPath which applies sane defaults
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at binding/golang/service/config.go:65 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/816d1af133b6ced5. Report an issue: GitHub.