lionsoul2014/ip2region · error
config.searchers must > 0
Error message
config.searchers must > 0
What it means
Go pool constructor guard: NewSearcherPool refuses a config with searchers < 1 because the channel-based pool needs at least one searcher to be useful; the config was built with an invalid pool size.
Source
Thrown at binding/golang/service/searcher_pool.go:37
// @Date 2025/12/03
type SearcherPool struct {
// config
config *Config
// searcher pool
pool chan *xdb.Searcher
// for pool close
closing chan struct{}
// searcher number that was loaned out
loanCount int32
}
func NewSearcherPool(config *Config) (*SearcherPool, error) {
if config.searchers < 1 {
return nil, fmt.Errorf("config.searchers must > 0")
}
var eExit = false
var spObj = &SearcherPool{
config: config,
pool: make(chan *xdb.Searcher, config.searchers+1),
closing: make(chan struct{}, 1),
loanCount: 0,
}
// error closing
defer func() {
if eExit {
spObj.Close()
}
}()
View on GitHub (pinned to c1a1fc7d59)
Solutions
- Set config.searchers to >= 1 when building the Config
- Use the library defaults (20 searchers) via NewIp2RegionWithPath
- Validate pool size in your own configuration layer
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at binding/golang/service/searcher_pool.go:37 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/5c90ff73e5edfdbe.
Report an issue: GitHub.