lionsoul2014/ip2region · error

failed to create v6 in-memory searcher: %w

Error message

failed to create v6 in-memory searcher: %w

What it means

Go service factory: creating the shared in-memory v6 searcher from the preloaded content buffer failed; like the v4 twin, the wrapped cause is typically an invalid or truncated content buffer.

Source

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

	} 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)
		if err != nil {
			return nil, fmt.Errorf("failed to create v6 searcher pool: %w", err)
		}
	}

	return &Ip2Region{
		v4Pool:          v4Pool,
		v4InMemSearcher: v4InMemSearcher,

		v6Pool:          v6Pool,
		v6InMemSearcher: v6InMemSearcher,
	}, nil
}

View on GitHub (pinned to c1a1fc7d59)

Solutions

  1. Ensure the v6 xdb content in the config is valid and fully loaded
  2. Rebuild the v6 config from a good database file
  3. Examine the wrapped error for the buffer validation detail
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at binding/golang/service/ip2region.go:72 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/0ce3505a33c8851f. Report an issue: GitHub.