{"record":{"id":"a68dd524e9413969","repo":"weaviate/weaviate","slug":"identify-groups","errorCode":null,"errorMessage":"identify groups","messagePattern":"identify groups","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters/repos/db/aggregator/grouped.go","lineNumber":38,"sourceCode":"\n// groupedAggregator performs aggregation in groups. This is a two-step\n// process. First a whole-db scan is performed to identify the groups, then\n// the top-n groups are selected (the rest is discarded). Only for those top\n// groups an actual aggregation is performed\ntype groupedAggregator struct {\n\t*Aggregator\n}\n\nfunc newGroupedAggregator(agg *Aggregator) *groupedAggregator {\n\treturn &groupedAggregator{Aggregator: agg}\n}\n\nfunc (ga *groupedAggregator) Do(ctx context.Context) (*aggregation.Result, error) {\n\tout := aggregation.Result{}\n\n\tgroups, err := ga.identifyGroups(ctx)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"identify groups\")\n\t}\n\n\tout.Groups = make([]aggregation.Group, len(groups))\n\tfor i, g := range groups {\n\t\tres, err := ga.aggregateGroup(ctx, g.res, g.docIDs)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"aggregate group %d (%v)\", i,\n\t\t\t\tg.res.GroupedBy.Value)\n\t\t}\n\t\tout.Groups[i] = res\n\t}\n\n\treturn &out, nil\n}\n\n// group is a helper construct that contains the final aggregation.Group which\n// will eventually be served to the user. But it also contains the list of\n// docIDs in that group, so we can use those to perform the actual aggregation","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/repos/db/aggregator/grouped.go#L20-L56","documentation":"groupedAggregator.Do wraps failures from identifyGroups, the phase that scans the shard(s) and partitions document IDs into groups by the GroupBy property value. Any error during that scan (store read failure, object unmarshal failure, grouper error such as 'group all (unfiltered)') is re-wrapped with this message. The aggregation aborted before any group-level aggregation ran.","triggerScenarios":"Executing a grouped aggregation (groupBy parameter) where the underlying LSM scan or object decoding fails: corrupt objects, disk I/O errors, invalid GroupBy property, or context cancellation during the scan.","commonSituations":"Corrupted object data in a shard after a crash; groupBy on a property that cannot be extracted; disk errors; a query cancelled client-side that surfaces mid-scan.","solutions":["Inspect the wrapped inner error (this message is only a wrapper) to find the root cause","Verify shard integrity; restore from backup if object corruption is reported","Retry the aggregation if the cause was transient (disk/context timeout)","Validate the groupBy property name and type against the schema"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"res, err := ga.Do(ctx)\nif err != nil {\n    if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {\n        // increase timeout / reissue query\n        return retryWithLongerTimeout(ctx)\n    }\n    return fmt.Errorf(\"grouped aggregation failed: %w\", err)\n}","preventionTips":["Set generous timeouts for grouped aggregations on large collections","Monitor shard disk health to avoid scan failures","Validate the groupBy property exists in the schema before querying"],"tags":["aggregation","grouping","scan"],"backgroundTag":"aggregation-group-scan-failed","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}