SigNoz/signoz · error
invalid query type
Error message
invalid query type
What it means
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'.
Source
Thrown at pkg/query-service/app/querier/querier.go:535
}
// in builder query, the only errors we expose are the ones that exceed the resource limits
// everything else is internal error as they are not actionable by the user
for name, err := range errQueriesByName {
if !chErrors.IsResourceLimitError(err) {
delete(errQueriesByName, name)
}
}
case v3.QueryTypePromQL:
results, errQueriesByName, err = q.runPromQueries(ctx, orgID, params)
case v3.QueryTypeClickHouseSQL:
ctx = context.WithValue(ctx, "enforce_max_result_rows", true)
if params.CompositeQuery.PanelType == v3.PanelTypeList || params.CompositeQuery.PanelType == v3.PanelTypeTrace {
results, errQueriesByName, err = q.runBuilderListQueries(ctx, params)
} else {
results, errQueriesByName, err = q.runClickHouseQueries(ctx, params)
}
default:
err = fmt.Errorf("invalid query type")
}
}
// return error if the number of series is more than one for value type panel
if params.CompositeQuery.PanelType == v3.PanelTypeValue {
if len(results) > 1 && params.CompositeQuery.EnabledQueries() > 1 {
err = fmt.Errorf("there can be only one active query for value type panel")
} else if len(results) == 1 && len(results[0].Series) > 1 {
err = fmt.Errorf("there can be only one result series for value type panel but got %d", len(results[0].Series))
}
}
return results, errQueriesByName, err
}
func (q *querier) QueriesExecuted() []string {
return q.queriesExecuted
}View on GitHub (pinned to 5069bf80b0)
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
Example fix
// before
{"compositeQuery":{"queries":[{"queryType":"prom"}]}}
// after
{"compositeQuery":{"queries":[{"queryType":0,"expression":"rate(http_requests_total[5m])"}]}} Defensive patterns
Strategy: type-guard
Validate before calling
validTypes := map[v3.QueryType]bool{v3.QueryTypePromQL: true, v3.QueryTypeQueryBuilder: true}
for _, q := range params.CompositeQuery.Queries {
if !validTypes[q.QueryType] { return fmt.Errorf("unsupported query type %v", q.QueryType) }
} Type guard
func isValidQueryType(t v3.QueryType) bool {
return t == v3.QueryTypePromQL || t == v3.QueryTypeQueryBuilder
} Prevention
- Use SDK enums/constants instead of raw strings for queryType
- Pin client and server versions together
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- error in prom queries
- error in clickhouse queries
- composite query is required
- composite query must contain at least one query type
- query type is invalid: %w
AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28).
Data as JSON: /api/errors/1df3b3678d119b66.
Report an issue: GitHub.