{"record":{"id":"1df3b3678d119b66","repo":"SigNoz/signoz","slug":"invalid-query-type","errorCode":null,"errorMessage":"invalid query type","messagePattern":"invalid query type","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/query-service/app/querier/querier.go","lineNumber":535,"sourceCode":"\t\t\t}\n\t\t\t// in builder query, the only errors we expose are the ones that exceed the resource limits\n\t\t\t// everything else is internal error as they are not actionable by the user\n\t\t\tfor name, err := range errQueriesByName {\n\t\t\t\tif !chErrors.IsResourceLimitError(err) {\n\t\t\t\t\tdelete(errQueriesByName, name)\n\t\t\t\t}\n\t\t\t}\n\t\tcase v3.QueryTypePromQL:\n\t\t\tresults, errQueriesByName, err = q.runPromQueries(ctx, orgID, params)\n\t\tcase v3.QueryTypeClickHouseSQL:\n\t\t\tctx = context.WithValue(ctx, \"enforce_max_result_rows\", true)\n\t\t\tif params.CompositeQuery.PanelType == v3.PanelTypeList || params.CompositeQuery.PanelType == v3.PanelTypeTrace {\n\t\t\t\tresults, errQueriesByName, err = q.runBuilderListQueries(ctx, params)\n\t\t\t} else {\n\t\t\t\tresults, errQueriesByName, err = q.runClickHouseQueries(ctx, params)\n\t\t\t}\n\t\tdefault:\n\t\t\terr = fmt.Errorf(\"invalid query type\")\n\t\t}\n\t}\n\n\t// return error if the number of series is more than one for value type panel\n\tif params.CompositeQuery.PanelType == v3.PanelTypeValue {\n\t\tif len(results) > 1 && params.CompositeQuery.EnabledQueries() > 1 {\n\t\t\terr = fmt.Errorf(\"there can be only one active query for value type panel\")\n\t\t} else if len(results) == 1 && len(results[0].Series) > 1 {\n\t\t\terr = fmt.Errorf(\"there can be only one result series for value type panel but got %d\", len(results[0].Series))\n\t\t}\n\t}\n\n\treturn results, errQueriesByName, err\n}\n\nfunc (q *querier) QueriesExecuted() []string {\n\treturn q.queriesExecuted\n}","sourceCodeStart":517,"sourceCodeEnd":553,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/app/querier/querier.go#L517-L553","documentation":"QueryRange dispatches on the composite query's query type (PromQL, QueryBuilder, PromQLDirector...). An unknown type in the switch hits the default branch and returns 'invalid query type'.","triggerScenarios":"Posting a QueryRangeParamsV3 payload where compositeQuery.queries[].queryType is not one of the supported values (e.g. a typo like 'promql ' or a new/renamed type from a mismatched client version).","commonSituations":"Hand-crafted API payloads with wrong queryType strings, client/server version skew after an upgrade where query type enums changed, truncated JSON mangling the enum.","solutions":["Check compositeQuery.queries[].queryType and set it to a supported value (e.g. 0=PromQL / 1=QueryBuilder per v3 constants)","Update the client SDK / UI to a version matching the query-service API","Validate the payload against the v3.QueryRangeParamsV3 schema before sending"],"exampleFix":"// before\n{\"compositeQuery\":{\"queries\":[{\"queryType\":\"prom\"}]}}\n// after\n{\"compositeQuery\":{\"queries\":[{\"queryType\":0,\"expression\":\"rate(http_requests_total[5m])\"}]}}","handlingStrategy":"type-guard","validationCode":"validTypes := map[v3.QueryType]bool{v3.QueryTypePromQL: true, v3.QueryTypeQueryBuilder: true}\nfor _, q := range params.CompositeQuery.Queries {\n    if !validTypes[q.QueryType] { return fmt.Errorf(\"unsupported query type %v\", q.QueryType) }\n}","typeGuard":"func isValidQueryType(t v3.QueryType) bool {\n    return t == v3.QueryTypePromQL || t == v3.QueryTypeQueryBuilder\n}","tryCatchPattern":null,"preventionTips":["Use SDK enums/constants instead of raw strings for queryType","Pin client and server versions together"],"tags":["api-validation","query-type","composite-query"],"backgroundTag":"request-validation-failed","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}