weaviate/weaviate · error
add meta count
Error message
add meta count
What it means
Wrapper error produced by unfilteredAggregator.Do when IncludeMetaCount is set and addMetaCount fails. addMetaCount counts all objects in the shard's objects bucket; it fails if the bucket is missing or the underlying LSM Count call errors. The wrap only adds context — the root cause is in the wrapped error.
Source
Thrown at adapters/repos/db/aggregator/unfiltered.go:49
// However, this aggregator does not work with subselections of the dataset,
// such as when grouping or a filter is set.
type unfilteredAggregator struct {
*Aggregator
}
func newUnfilteredAggregator(agg *Aggregator) *unfilteredAggregator {
return &unfilteredAggregator{Aggregator: agg}
}
func (ua *unfilteredAggregator) Do(ctx context.Context) (*aggregation.Result, error) {
out := aggregation.Result{}
// without grouping there is always exactly one group
out.Groups = make([]aggregation.Group, 1)
if ua.params.IncludeMetaCount {
if err := ua.addMetaCount(ctx, &out); err != nil {
return nil, errors.Wrap(err, "add meta count")
}
}
props, err := ua.properties(ctx)
if err != nil {
return nil, errors.Wrap(err, "aggregate properties")
}
out.Groups[0].Properties = props
return &out, nil
}
func (ua *unfilteredAggregator) addMetaCount(ctx context.Context,
out *aggregation.Result,
) error {
b := ua.store.Bucket(helpers.ObjectsBucketLSM)
if b == nil {View on GitHub (pinned to 75aa4b6d11)
Solutions
- Check the wrapped cause: 'objects bucket is nil' means the shard store isn't open — restart the node or inspect shard directory health
- If the cause is 'count objects', check for context cancellation/timeout and retry with a longer deadline
- Verify the collection/shard exists and the node finished startup before issuing meta-count aggregations
- Check disk health and LSM store logs for corruption; restore from backup if the shard is damaged
Example fix
// before (client)
res, err := graphql.Batch(aggWithMetaCount) // fails with 'add meta count: objects bucket is nil'
// after
if shardReady(node, class, shard) { res, err := graphql.Batch(aggWithMetaCount) } Defensive patterns
Strategy: try-catch
Validate before calling
// client: ensure collection + node ready before meta-count
status, _ := client.Schema().GetSchemaStatus(ctx, className)
if status == nil || status.Shards == nil { return errors.New("collection not ready") } Type guard
func shardReady(b BucketGetter) bool { return b != nil && b.Bucket(helpers.ObjectsBucketLSM) != nil } Try / catch
res, err := agg.Do(ctx)
if err != nil {
if strings.Contains(err.Error(), "objects bucket is nil") {
// shard store not open: restart/inspect shard, then retry
} else if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
// retry with longer deadline
}
return err
} Prevention
- Verify shard health after node startup before serving aggregations
- Set generous timeouts for meta-count on large collections
- Monitor LSM store open errors in startup logs
- Keep backups so torn shard dirs can be restored
When it happens
Trigger: A GraphQL { Meta { count } } or aggregate-with-metaCount query against an unfiltered aggregation where the shard's objects bucket is nil (shard still initializing, corrupted, or closed) or b.Count(ctx) returns an LSM/ctx error.
Common situations: Querying a shard while it is being loaded or dropped; corrupted/partially-created shard directories after a crash; context canceled or timed out during a long count on a large collection.
Related errors
- object bucket does not exist
- objects bucket not found
- get objects by doc id: %w
- buildRecGroupExecutor: meta bucket for %q not found
- objects bucket not found
AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04).
Data as JSON: /api/errors/a0fccfa215e35401.
Report an issue: GitHub.