{"record":{"id":"a18fcc07debb6ce1","repo":"SigNoz/signoz","slug":"having-operator-is-invalid-w","errorCode":null,"errorMessage":"having operator is invalid: %w","messagePattern":"having operator is invalid: %w","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/query-service/model/v3/v3.go","lineNumber":1094,"sourceCode":"\t\t}\n\n\t\tfor _, groupBy := range b.GroupBy {\n\t\t\tif err := groupBy.Validate(); err != nil {\n\t\t\t\treturn fmt.Errorf(\"group by is invalid %w\", err)\n\t\t\t}\n\t\t}\n\n\t\tif b.DataSource == DataSourceMetrics && len(b.GroupBy) > 0 && b.SpaceAggregation == SpaceAggregationUnspecified {\n\t\t\tif b.AggregateOperator == AggregateOperatorNoOp || b.AggregateOperator == AggregateOperatorRate {\n\t\t\t\treturn fmt.Errorf(\"group by requires aggregate operator other than noop or rate\")\n\t\t\t}\n\t\t}\n\t}\n\n\tif b.Having != nil {\n\t\tfor _, having := range b.Having {\n\t\t\tif err := having.Operator.Validate(); err != nil {\n\t\t\t\treturn fmt.Errorf(\"having operator is invalid: %w\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, selectColumn := range b.SelectColumns {\n\t\tif err := selectColumn.Validate(); err != nil {\n\t\t\treturn fmt.Errorf(\"select column is invalid %w\", err)\n\t\t}\n\t}\n\n\tif b.Expression == \"\" {\n\t\treturn fmt.Errorf(\"expression is required\")\n\t}\n\n\tif len(b.Functions) > 0 {\n\t\tfor _, function := range b.Functions {\n\t\t\tif err := function.Name.Validate(); err != nil {\n\t\t\t\treturn fmt.Errorf(\"function name is invalid: %w\", err)","sourceCodeStart":1076,"sourceCodeEnd":1112,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/model/v3/v3.go#L1076-L1112","documentation":"Every entry in the Having clause must have an operator from the supported set (equals, not_equals, greater_than, ...); otherwise having.Operator.Validate fails.","triggerScenarios":"Sending having with operator \"=\" or \"gt\" instead of the enum names like \"=\" aliases not supported, e.g. \"gt\".","commonSituations":"Building alert/dashboard having clauses programmatically with shorthand operators.","solutions":["Use supported having operator constants (equals, not_equals, greater_than, greater_than_eq, less_than, less_than_eq, contains, not_contains, in, not_in)","Check the wrapped error for the offending operator"],"exampleFix":"// before\n\"having\":[{\"columnName\":\"value\",\"op\":\"gt\",\"value\":10}]\n// after\n\"having\":[{\"columnName\":\"value\",\"op\":\"greater_than\",\"value\":10}]","handlingStrategy":"type-guard","validationCode":"for _, h := range q.Having { if err := h.Operator.Validate(); err != nil { return err } }","typeGuard":"func isValidHavingOp(op v3.FilterOperator) bool { return op.Validate() == nil }","tryCatchPattern":null,"preventionTips":["Use full operator names (greater_than) not shorthand (gt)"],"tags":["go","having-clause","enum-validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}