lionsoul2014/ip2region · error

failed to create v4 searcher pool: %w

Error message

failed to create v4 searcher pool: %w

What it means

Go service factory: NewSearcherPool failed while pre-creating the v4 searcher pool (each searcher open/verify fails individually); the wrapped error names the first searcher creation failure.

Source

Thrown at binding/golang/service/ip2region.go:58

	// check and init the v4 pool or in-memory searcher
	var v4Pool *SearcherPool
	var v4InMemSearcher *xdb.Searcher
	if v4Config == nil {
		// with IPv4 disabled ?
		v4Pool = nil
		v4InMemSearcher = nil
	} else if v4Config.cachePolicy == BufferCache {
		v4Pool = nil
		v4InMemSearcher, err = xdb.NewWithBuffer(v4Config.ipVersion, v4Config.cBuffer)
		if err != nil {
			return nil, fmt.Errorf("failed to create v4 in-memory searcher: %w", err)
		}
	} else {
		v4InMemSearcher = nil
		v4Pool, err = NewSearcherPool(v4Config)
		if err != nil {
			return nil, fmt.Errorf("failed to create v4 searcher pool: %w", err)
		}
	}

	// check and init the v6 pool or in-memory searcher
	var v6Pool *SearcherPool
	var v6InMemSearcher *xdb.Searcher
	if v6Config == nil {
		v6Pool = nil
		v6InMemSearcher = nil
	} else if v6Config.cachePolicy == BufferCache {
		v6Pool = nil
		v6InMemSearcher, err = xdb.NewWithBuffer(v6Config.ipVersion, v6Config.cBuffer)
		if err != nil {
			return nil, fmt.Errorf("failed to create v6 in-memory searcher: %w", err)
		}
	} else {
		v6InMemSearcher = nil
		v6Pool, err = NewSearcherPool(v6Config)

View on GitHub (pinned to c1a1fc7d59)

Solutions

  1. Check the v4 xdb path, permissions and integrity reported by the wrapped error
  2. Reduce dependence on file access by using the content cache policy
  3. Retry after the underlying file issue is fixed
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at binding/golang/service/ip2region.go:58 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/01f56a0ea61c3a3f. Report an issue: GitHub.