weaviate/weaviate · error
set secondary index %d on an index of length %d
Error message
set secondary index %d on an index of length %d
What it means
WithSecondaryKey is a guard-style validation option: it rejects any write attempt that supplies a secondary key at a position beyond the configured secondary-index capacity of the bucket. The caller passed pos greater than the number of allocated secondary index slots, which would corrupt the segment layout.
Source
Thrown at adapters/repos/db/lsmkv/bucket_options.go:201
return nil
}
}
func WithWriteSegmentInfoIntoFileName(writeSegmentInfoIntoFileName bool) BucketOption {
return func(b *Bucket) error {
b.writeSegmentInfoIntoFileName = writeSegmentInfoIntoFileName
return nil
}
}
type secondaryIndexKeys [][]byte
type SecondaryKeyOption func(s secondaryIndexKeys) error
func WithSecondaryKey(pos int, key []byte) SecondaryKeyOption {
return func(s secondaryIndexKeys) error {
if pos > len(s) {
return errors.Errorf("set secondary index %d on an index of length %d",
pos, len(s))
}
s[pos] = key
return nil
}
}
func WithMonitorCount() BucketOption {
return func(b *Bucket) error {
if b.strategy != StrategyReplace {
return errors.Errorf("count monitoring only supported on 'replace' buckets")
}
b.monitorCount = true
return nil
}
}View on GitHub (pinned to 75aa4b6d11)
Solutions
- Fix the caller to only use positions 0..secondaryIndexCount-1 when inserting
- Ensure the bucket is created with enough secondary indices for the keys being written
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at adapters/repos/db/lsmkv/bucket_options.go:201 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04).
Data as JSON: /api/errors/cbbc230870fb652c.
Report an issue: GitHub.