{"record":{"id":"2d80a0a1cf4c3d45","repo":"SigNoz/signoz","slug":"invalid-time-aggregation-s","errorCode":null,"errorMessage":"invalid time aggregation: %s","messagePattern":"invalid time aggregation: (.+?)","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/query-service/model/v3/v3.go","lineNumber":701,"sourceCode":"\tTimeAggregationCountDistinct TimeAggregation = \"count_distinct\"\n\tTimeAggregationRate          TimeAggregation = \"rate\"\n\tTimeAggregationIncrease      TimeAggregation = \"increase\"\n)\n\nfunc (t TimeAggregation) Validate() error {\n\tswitch t {\n\tcase TimeAggregationAnyLast,\n\t\tTimeAggregationSum,\n\t\tTimeAggregationAvg,\n\t\tTimeAggregationMin,\n\t\tTimeAggregationMax,\n\t\tTimeAggregationCount,\n\t\tTimeAggregationCountDistinct,\n\t\tTimeAggregationRate,\n\t\tTimeAggregationIncrease:\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(\"invalid time aggregation: %s\", t)\n\t}\n}\n\nfunc (t TimeAggregation) IsRateOperator() bool {\n\tswitch t {\n\tcase TimeAggregationRate, TimeAggregationIncrease:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}\n\ntype MetricType string\n\nconst (\n\tMetricTypeUnspecified          MetricType = \"\"\n\tMetricTypeSum                  MetricType = \"Sum\"\n\tMetricTypeGauge                MetricType = \"Gauge\"","sourceCodeStart":683,"sourceCodeEnd":719,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/model/v3/v3.go#L683-L719","documentation":"Thrown by TimeAggregation.Validate when the time aggregation string is not in the allowed set (noop, count, count_distinct, sum, min, max, avg, rate, increase, etc.).","triggerScenarios":"Setting BuilderQuery.TimeAggregation to an unrecognized value like \"average\" or \"sum_rate\" via the v3 builder payload.","commonSituations":"Newer frontend emitting a time aggregation the deployed server doesn't recognize, or manual payload construction with guessed enum names.","solutions":["Use exact snake_case values from the TimeAggregation constants in v3.go","Upgrade SigNoz query service to the version whose enum set includes your value","Map user-friendly names to constants before building the payload"],"exampleFix":"// before\n\"timeAggregation\":\"average\"\n// after\n\"timeAggregation\":\"avg\"","handlingStrategy":"type-guard","validationCode":"if err := q.TimeAggregation.Validate(); err != nil { return err } // client-side pre-check","typeGuard":"func isValidTimeAgg(t v3.TimeAggregation) bool { return t.Validate() == nil }","tryCatchPattern":null,"preventionTips":["Expose a dropdown of server-supported time aggregations in the UI"],"tags":["go","enum-validation","time-aggregation"],"backgroundTag":"invalid-enum-value","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}