{"record":{"id":"5b31fd317f65a0a7","repo":"SigNoz/signoz","slug":"select-column-is-invalid-w","errorCode":null,"errorMessage":"select column is invalid %w","messagePattern":"select column is invalid %w","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/query-service/model/v3/v3.go","lineNumber":1101,"sourceCode":"\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)\n\t\t\t}\n\t\t\tif function.Name == FunctionNameTimeShift {\n\t\t\t\tif len(function.Args) == 0 {\n\t\t\t\t\treturn fmt.Errorf(\"timeShiftBy param missing in query\")\n\t\t\t\t}\n\t\t\t\t_, ok := function.Args[0].(float64)\n\t\t\t\tif !ok {","sourceCodeStart":1083,"sourceCodeEnd":1119,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/model/v3/v3.go#L1083-L1119","documentation":"Each column in selectColumns must pass AttributeKey.Validate (non-empty key, valid shape); otherwise the builder query is rejected.","triggerScenarios":"selectColumns containing an entry with an empty key or malformed attribute.","commonSituations":"Logs/traces list panels where selected columns come from user input and empty entries slip in.","solutions":["Remove entries with empty keys from selectColumns","Ensure each entry has key plus type/dataType as needed"],"exampleFix":"// before\n\"selectColumns\":[{\"key\":\"\"}]\n// after\n\"selectColumns\":[{\"key\":\"trace_id\"}]","handlingStrategy":"validation","validationCode":"for _, c := range q.SelectColumns { if strings.TrimSpace(c.Key) == \"\" { return errors.New(\"select column key required\") } }","typeGuard":"func hasValidSelectColumns(cols []v3.AttributeKey) bool { for _, c := range cols { if c.Key == \"\" { return false } }; return true }","tryCatchPattern":null,"preventionTips":["Prune empty column entries from UI state before submit"],"tags":["go","select-columns","attribute-key"],"backgroundTag":"query-payload-validation-failed","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}