{"record":{"id":"0aa142ab988707da","repo":"SigNoz/signoz","slug":"invalid-query-type-s","errorCode":null,"errorMessage":"invalid query type: %s","messagePattern":"invalid query type: (.+?)","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/query-service/model/v3/v3.go","lineNumber":199,"sourceCode":"\t\treturn fmt.Errorf(\"invalid reduce to operator: %s\", r)\n\t}\n}\n\ntype QueryType string\n\nconst (\n\tQueryTypeUnknown       QueryType = \"unknown\"\n\tQueryTypeBuilder       QueryType = \"builder\"\n\tQueryTypeClickHouseSQL QueryType = \"clickhouse_sql\"\n\tQueryTypePromQL        QueryType = \"promql\"\n)\n\nfunc (q QueryType) Validate() error {\n\tswitch q {\n\tcase QueryTypeBuilder, QueryTypeClickHouseSQL, QueryTypePromQL:\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(\"invalid query type: %s\", q)\n\t}\n}\n\ntype PanelType string\n\nconst (\n\tPanelTypeValue PanelType = \"value\"\n\tPanelTypeGraph PanelType = \"graph\"\n\tPanelTypeTable PanelType = \"table\"\n\tPanelTypeList  PanelType = \"list\"\n\tPanelTypeTrace PanelType = \"trace\"\n)\n\nfunc (p PanelType) Validate() error {\n\tswitch p {\n\tcase PanelTypeValue, PanelTypeGraph, PanelTypeTable, PanelTypeList, PanelTypeTrace:\n\t\treturn nil\n\tdefault:","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/model/v3/v3.go#L181-L217","documentation":"QueryType.Validate() fails when the composite query's type is not \"builder\" (QueryTypeBuilder), \"clickhouse_sql\" (QueryTypeClickHouseSQL), or \"promql\" (QueryTypePromQL). The query type selects which query payload branch the server interprets.","triggerScenarios":"POSTing a query with compositeQuery.queryType set to something like \"sql\", \"Builder\", \"prom\", or omitted/empty, causing CompositeQuery.Validate() to propagate this error.","commonSituations":"Migrating from v2/v1 query APIs whose type names differ, typos in hand-built JSON, or a client using a newer/older queryType constant name than the deployed server.","solutions":["Set queryType to exactly one of: \"builder\", \"clickhouse_sql\", \"promql\"","Ensure the matching query payload (BuilderQueries / ClickHouseQueries / PromQueries) is present for that type","Check the QueryType constants in v3.go for the canonical string values in your server version"],"exampleFix":"// before\n{ \"queryType\": \"sql\", \"clickHouseQueries\": {...} }\n\n// after\n{ \"queryType\": \"clickhouse_sql\", \"clickHouseQueries\": {...} }","handlingStrategy":"validation","validationCode":"qt := cq.QueryType\nif qt != v3.QueryTypeBuilder && qt != v3.QueryTypeClickHouseSQL && qt != v3.QueryTypePromQL { return fmt.Errorf(\"bad queryType %q\", qt) }","typeGuard":"func isValidQueryType(q v3.QueryType) bool { return q == v3.QueryTypeBuilder || q == v3.QueryTypeClickHouseSQL || q == v3.QueryTypePromQL }","tryCatchPattern":null,"preventionTips":["Pin queryType to a constant shared by client and server","Ensure the query payload matches the chosen type"],"tags":["go","validation","enum","query-builder","signoz"],"backgroundTag":"invalid-enum-value","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}