{"record":{"id":"8827ebe3f025d8da","repo":"SigNoz/signoz","slug":"query-type-is-invalid-w","errorCode":null,"errorMessage":"query type is invalid: %w","messagePattern":"query type is invalid: %w","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/query-service/model/v3/v3.go","lineNumber":646,"sourceCode":"\t\t\t\treturn fmt.Errorf(\"clickhouse query %s is invalid: %w\", name, err)\n\t\t\t}\n\t\t}\n\t}\n\n\tif c.QueryType == QueryTypePromQL {\n\t\tfor name, query := range c.PromQueries {\n\t\t\tif err := query.Validate(); err != nil {\n\t\t\t\treturn fmt.Errorf(\"prom query %s is invalid: %w\", name, err)\n\t\t\t}\n\t\t}\n\t}\n\n\tif err := c.PanelType.Validate(); err != nil {\n\t\treturn fmt.Errorf(\"panel type is invalid: %w\", err)\n\t}\n\n\tif err := c.QueryType.Validate(); err != nil {\n\t\treturn fmt.Errorf(\"query type is invalid: %w\", err)\n\t}\n\n\treturn nil\n}\n\ntype Temporality string\n\nconst (\n\tUnspecified Temporality = \"Unspecified\"\n\tDelta       Temporality = \"Delta\"\n\tCumulative  Temporality = \"Cumulative\"\n)\n\nfunc (t *Temporality) Scan(src interface{}) error {\n\tif src == nil {\n\t\t*t = \"\"\n\t\treturn nil\n\t}","sourceCodeStart":628,"sourceCodeEnd":664,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/model/v3/v3.go#L628-L664","documentation":"Thrown by CompositeQuery.Validate when the query type is not one of the recognized values (builder, clickhouse_sql, promql). %w wraps QueryType.Validate's inner error.","triggerScenarios":"Passing queryType such as \"cli\", \"sql\", or omitting it while still including query maps.","commonSituations":"Version drift between frontend and query service, or hand-written payloads using informal names like \"sql\" instead of \"clickhouse_sql\".","solutions":["Use exactly \"builder\", \"clickhouse_sql\", or \"promql\"","Match the map you populate (BuilderQueries vs ClickHouseQueries vs PromQueries) to the queryType"],"exampleFix":"// before\n{\"queryType\":\"sql\",\"clickHouseQueries\":{...}}\n// after\n{\"queryType\":\"clickhouse_sql\",\"clickHouseQueries\":{...}}","handlingStrategy":"type-guard","validationCode":"switch c.QueryType { case v3.QueryTypeBuilder, v3.QueryTypeClickHouseSQL, v3.QueryTypePromQL: default: return errors.New(\"invalid query type\") }","typeGuard":"func isValidQueryType(t v3.QueryType) bool { return t == v3.QueryTypeBuilder || t == v3.QueryTypeClickHouseSQL || t == v3.QueryTypePromQL }","tryCatchPattern":null,"preventionTips":["Derive queryType from which query map you populate"],"tags":["go","enum-validation","query-type"],"backgroundTag":"invalid-enum-value","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}