{"record":{"id":"b1418458a425c52b","repo":"SigNoz/signoz","slug":"invalid-space-aggregation-s","errorCode":null,"errorMessage":"invalid space aggregation: %s","messagePattern":"invalid space aggregation: (.+?)","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/query-service/model/v3/v3.go","lineNumber":768,"sourceCode":"\tSpaceAggregationPercentile95 SpaceAggregation = \"p95\"\n\tSpaceAggregationPercentile99 SpaceAggregation = \"p99\"\n)\n\nfunc (s SpaceAggregation) Validate() error {\n\tswitch s {\n\tcase SpaceAggregationSum,\n\t\tSpaceAggregationAvg,\n\t\tSpaceAggregationMin,\n\t\tSpaceAggregationMax,\n\t\tSpaceAggregationCount,\n\t\tSpaceAggregationPercentile50,\n\t\tSpaceAggregationPercentile75,\n\t\tSpaceAggregationPercentile90,\n\t\tSpaceAggregationPercentile95,\n\t\tSpaceAggregationPercentile99:\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(\"invalid space aggregation: %s\", s)\n\t}\n}\n\nfunc IsPercentileOperator(operator SpaceAggregation) bool {\n\tswitch operator {\n\tcase SpaceAggregationPercentile50,\n\t\tSpaceAggregationPercentile75,\n\t\tSpaceAggregationPercentile90,\n\t\tSpaceAggregationPercentile95,\n\t\tSpaceAggregationPercentile99:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}\n\nfunc GetPercentileFromOperator(operator SpaceAggregation) float64 {\n\t// This could be done with a map, but it's just easier to read this way","sourceCodeStart":750,"sourceCodeEnd":786,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/model/v3/v3.go#L750-L786","documentation":"Thrown by SpaceAggregation.Validate when the space aggregation value is not in the permitted set (noop through percentile99 and rate variants).","triggerScenarios":"Setting spaceAggregation to a value outside the allowed set (sum, avg, min, max, p25/p50/p75/p90/p95/p99, count_distinct, rate_sum, rate_avg, rate_max, rate_min).","commonSituations":"Frontend/backend version mismatch on newly added space aggregations, or typos like \"percentile95\" instead of \"p95\".","solutions":["Use exact values from the SpaceAggregation constants","Upgrade query service if the value was added in a newer release","Validate enum client-side against a generated list"],"exampleFix":"// before\n\"spaceAggregation\":\"percentile95\"\n// after\n\"spaceAggregation\":\"p95\"","handlingStrategy":"type-guard","validationCode":"if q.SpaceAggregation != \"\" { if err := q.SpaceAggregation.Validate(); err != nil { return err } }","typeGuard":"func isValidSpaceAgg(s v3.SpaceAggregation) bool { return s.Validate() == nil }","tryCatchPattern":null,"preventionTips":["Map percentiles to p50/p90/p95/p99 naming, not 'percentile95'"],"tags":["go","enum-validation","space-aggregation"],"backgroundTag":"invalid-enum-value","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}