weaviate/weaviate · error

aggregate: %w

Error message

aggregate: %w

What it means

The underlying traverser.Aggregate() call failed after params parsed successfully. This wraps any error from the aggregation execution pipeline (shard access, permission checks, index errors, timeout) and marks it as originating from the aggregate stage of the gRPC Aggregate RPC.

Source

Thrown at adapters/handlers/grpc/v1/service.go:124

	if req.Collection, _, err = namespacing.Resolve(principal, s.schemaManager, s.config.Namespaces.Enabled, req.Collection); err != nil {
		return nil, err
	}

	getClass := s.classGetterWithAuthzFunc(ctx, principal, req.Tenant)
	parser := NewAggregateParser(
		getClass,
		s.config.Namespaces.Enabled,
		principal,
	)

	params, err := parser.Aggregate(req)
	if err != nil {
		return nil, fmt.Errorf("parse params: %w", err)
	}

	res, err := s.traverser.Aggregate(restCtx.AddPrincipalToContext(ctx, principal), principal, params)
	if err != nil {
		return nil, fmt.Errorf("aggregate: %w", err)
	}

	replier := NewAggregateReplier(
		principal,
		getClass,
		params,
	)
	reply, err = replier.Aggregate(res, params.GroupBy != nil)
	if err != nil {
		return nil, fmt.Errorf("prepare reply: %w", err)
	}

	reply.Took = float32(time.Since(before).Seconds())
	return reply, nil
}

func (s *Service) TenantsGet(ctx context.Context, req *pb.TenantsGetRequest) (reply *pb.TenantsGetReply, retErr error) {
	before := time.Now()

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Inspect the wrapped error to determine the traversal-stage cause
  2. Verify cluster health and that all shards of the collection are available
  3. Check the principal's authorization for the aggregate action on the collection
  4. Retry with backoff on transient shard/timeout errors; increase server timeout for large collections

Example fix

// before: no deadline, giant aggregation times out
res, err := client.Aggregate(ctx, req)
// after: bounded deadline and retry on transient errors
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
defer cancel()
res, err := client.Aggregate(ctx, req)
Defensive patterns

Strategy: retry

Validate before calling

if !clusterHealthy() { return errors.New("cluster unhealthy; defer aggregation") }

Try / catch

res, err := client.Aggregate(ctx, req)
if err != nil && strings.Contains(err.Error(), "aggregate:") {
  return retryWithBackoff(func() error { _, err := client.Aggregate(ctx, req); return err })
}

Prevention

When it happens

Trigger: Calling the gRPC Aggregate RPC when the traverser fails: collection deleted concurrently, shard unavailable/unhealthy, authorization denied inside traversal, context cancelled/timeout, or internal aggregation errors on remote shards.

Common situations: Cluster node down or shard still migrating; RBAC principal lacks aggregate permission; aggregation timeout on very large collections; client cancelled the RPC mid-query.

Related errors


AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04). Data as JSON: /api/errors/24b96564a6db768f. Report an issue: GitHub.