weaviate/weaviate · error
hashtree level %d: discriminant size %d, expected %d (height
Error message
hashtree level %d: discriminant size %d, expected %d (height mismatch?)
What it means
Validation guard in Shard.HashTreeLevel: the discriminant bitset's size does not match hashtree.LeavesCount(level), so it was built for a different tree height and cannot select digests at the requested level.
Source
Thrown at adapters/repos/db/shard_async_replication.go:1607
return nil, fmt.Errorf("hashtree level %d: nil discriminant", level)
}
s.asyncReplicationRWMux.RLock()
defer s.asyncReplicationRWMux.RUnlock()
if s.hashtree == nil || !s.hashtreeFullyInitialized {
return nil, fmt.Errorf("%w: hashtree not initialized on shard %q", errAsyncReplicationNotActive, s.ID())
}
// Transient during a rolling height change — retry-later, not an error.
if height := s.hashtree.Height(); level > height {
return nil, fmt.Errorf("%w: hashtree level %d exceeds height %d on shard %q",
errAsyncReplicationNotActive, level, height, s.ID())
}
expected := hashtree.LeavesCount(level)
if discriminant.Size() != expected {
return nil, fmt.Errorf("hashtree level %d: discriminant size %d, expected %d (height mismatch?)",
level, discriminant.Size(), expected)
}
digests = make([]hashtree.Digest, discriminant.SetCount())
n, err := s.hashtree.Level(level, discriminant, digests)
if err != nil {
return nil, err
}
return digests[:n], nil
}
var (
errAsyncReplicationNotActive = replica.ErrAsyncReplicationNotActive
errAsyncCheckpointStale = replica.ErrAsyncCheckpointStale
errAsyncCheckpointCutoffInPast = replica.ErrAsyncCheckpointCutoffInPast
)View on GitHub (pinned to 75aa4b6d11)
Solutions
- Rebuild the discriminant with the correct size for the requested level.
- Check for height mismatch between coordinator and replica (height rolling change in progress).
- No retry until the discriminant is regenerated consistently.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at adapters/repos/db/shard_async_replication.go:1607 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/1e95243659e5ca7b.
Report an issue: GitHub.