thanos-io/thanos · error
invalid factor
Error message
invalid factor
What it means
The bucket growth factor in NewBucketedPool must be >= 1. Each bucket size is computed by multiplying the previous size by factor until maxSize; a factor < 1 would shrink toward zero and generate an invalid/degenerate bucket ladder.
Solutions
- Pass a factor >= 1; use 2 for doubling (common default)
- If a percentage was intended, convert it: factor = 1 + pct/100
- Validate the config value before constructing the pool
Example fix
// before pool, err := pool.NewBucketedPool[byte](1<<10, 1<<22, 0.5, 0) // after pool, err := pool.NewBucketedPool[byte](1<<10, 1<<22, 2.0, 0)
Defensive patterns
Strategy: validation
Validate before calling
if factor < 1 {
return errors.New("pool growth factor must be >= 1")
}
pool, err := pool.NewBucketedPool[byte](minSize, maxSize, factor, maxTotal) Try / catch
p, err := pool.NewBucketedPool[byte](minSize, maxSize, factor, maxTotal)
if err != nil {
return fmt.Errorf("configuring chunk pool: %w", err)
} Prevention
- Use constants like 2.0 for the factor instead of config-derived floats
- If the value is a percentage, convert to a multiplicative factor first
- Document the factor semantics (multiplicative growth, not percent)
When it happens
Trigger: NewBucketedPool[T](minSize, maxSize, 0.5, maxTotal) or factor 0 / negative, usually from a misread config option for pool growth.
Common situations: Tuning pool memory by setting a fractional 'growth' value; copy-paste of factor as percentage 0.5 intending 1.5 or 2.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- invalid minimum pool size
- invalid maximum pool size
- parse limit configuration
- --receive.lazy-retrieval-max-buffered-responses must be > 0
- found that Prometheus and Thanos use different paths for…
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/0c0a535021515bb9.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/pool/pool.go:65
if err != nil {
panic(err)
}
return pool
}
// NewBucketedPool returns a new BucketedPool with size buckets for minSize to
// maxSize increasing by the given factor and maximum number of used items. No
// more than maxTotal items can be used at any given time unless maxTotal is set
// to 0.
func NewBucketedPool[T any](minSize, maxSize int, factor float64, maxTotal uint64) (*BucketedPool[T], error) {
if minSize < 1 {
return nil, errors.New("invalid minimum pool size")
}
if maxSize < 1 {
return nil, errors.New("invalid maximum pool size")
}
if factor < 1 {
return nil, errors.New("invalid factor")
}
var sizes []int
for s := minSize; s <= maxSize; s = int(float64(s) * factor) {
sizes = append(sizes, s)
}
p := &BucketedPool[T]{
buckets: make([]sync.Pool, len(sizes)),
sizes: sizes,
maxTotal: maxTotal,
new: func(sz int) *[]T {
s := make([]T, 0, sz)
return &s
},
}
return p, nil
}View on GitHub (pinned to 35b8b99117)