{"record":{"id":"3ff49f85e21e51ce","repo":"weaviate/weaviate","slug":"parse-params-w","errorCode":null,"errorMessage":"parse params: %w","messagePattern":"parse params: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters/handlers/grpc/v1/service.go","lineNumber":119,"sourceCode":"\t\treturn nil, fmt.Errorf(\"extract auth: %w\", err)\n\t}\n\tdefer func() { retErr = namespacing.StripErrForPrincipal(principal, retErr) }()\n\tctx = restCtx.AddPrincipalToContext(ctx, principal)\n\n\tif req.Collection, _, err = namespacing.Resolve(principal, s.schemaManager, s.config.Namespaces.Enabled, req.Collection); err != nil {\n\t\treturn nil, err\n\t}\n\n\tgetClass := s.classGetterWithAuthzFunc(ctx, principal, req.Tenant)\n\tparser := NewAggregateParser(\n\t\tgetClass,\n\t\ts.config.Namespaces.Enabled,\n\t\tprincipal,\n\t)\n\n\tparams, err := parser.Aggregate(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parse params: %w\", err)\n\t}\n\n\tres, err := s.traverser.Aggregate(restCtx.AddPrincipalToContext(ctx, principal), principal, params)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"aggregate: %w\", err)\n\t}\n\n\treplier := NewAggregateReplier(\n\t\tprincipal,\n\t\tgetClass,\n\t\tparams,\n\t)\n\treply, err = replier.Aggregate(res, params.GroupBy != nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"prepare reply: %w\", err)\n\t}\n\n\treply.Took = float32(time.Since(before).Seconds())","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/handlers/grpc/v1/service.go#L101-L137","documentation":"The gRPC Aggregate endpoint failed to translate the incoming protobuf aggregation request into the internal aggregation params structure. parser.Aggregate() validates the request (collection existence, aggregations shape, group-by, filters, tenant resolution) and returns an error, which is wrapped here so callers can see it came from parameter parsing before any traversal ran.","triggerScenarios":"Calling the gRPC Aggregate RPC with an invalid collection name, an aggregation spec the parser rejects (bad property, unsupported aggregation on a reference/none-string property without count, invalid groupBy path, unresolvable namespace/tenant), or a filter that fails validation.","commonSituations":"Client built the request against an outdated proto schema; typo'd property or collection names; aggregating a non-numeric property with a numeric aggregation; requesting groupBy on a field that cannot be grouped; namespace feature enabled but request uses raw collection name that needs namespacing resolution.","solutions":["Check the error's wrapped cause for the exact field rejected by the parser","Verify the collection name (including tenant/namespace prefix) exists and the principal can read it","Confirm each aggregation targets an existing property of the correct data type (numeric aggregations only on int/number)","Regenerate client stubs if the proto schema version differs from the server"],"exampleFix":"// before: aggregating price (string) with mean\nagg := &pb.Aggregate{ Collection: \"Product\", Properties: []*pb.AggregateProperty{{PropertyName: \"price\", NumericalAggregations: ...}} }\n// after: use count on non-numeric props, or fix schema type\nagg := &pb.Aggregate{ Collection: \"Product\", Properties: []*pb.AggregateProperty{{PropertyName: \"price\", Aggregations: []pb.Aggregation{{Type: pb.Aggregation_TYPE_COUNT}}}} }","handlingStrategy":"validation","validationCode":"func validateAggregateReq(req *pb.AggregateRequest) error {\n  if req == nil || req.Collection == \"\" { return errors.New(\"collection required\") }\n  for _, p := range req.Properties {\n    if p.PropertyName == \"\" { return errors.New(\"property name required\") }\n  }\n  return nil\n}","typeGuard":"func validAggProp(p *pb.AggregateProperty) bool { return p != nil && p.PropertyName != \"\" }","tryCatchPattern":"res, err := client.Aggregate(ctx, req)\nif err != nil && strings.Contains(err.Error(), \"parse params\") {\n  return fmt.Errorf(\"invalid aggregation request: %w\", err)\n}","preventionTips":["Validate collection and property names against the schema before calling","Only use numeric aggregations on int/number properties","Regenerate stubs when upgrading the server proto"],"tags":["grpc","aggregation","parameter-validation"],"backgroundTag":"grpc-request-params-invalid","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"}