SigNoz/signoz · error

query type is invalid: %w

Error message

query type is invalid: %w

What it means

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.

Source

Thrown at pkg/query-service/model/v3/v3.go:646

				return fmt.Errorf("clickhouse query %s is invalid: %w", name, err)
			}
		}
	}

	if c.QueryType == QueryTypePromQL {
		for name, query := range c.PromQueries {
			if err := query.Validate(); err != nil {
				return fmt.Errorf("prom query %s is invalid: %w", name, err)
			}
		}
	}

	if err := c.PanelType.Validate(); err != nil {
		return fmt.Errorf("panel type is invalid: %w", err)
	}

	if err := c.QueryType.Validate(); err != nil {
		return fmt.Errorf("query type is invalid: %w", err)
	}

	return nil
}

type Temporality string

const (
	Unspecified Temporality = "Unspecified"
	Delta       Temporality = "Delta"
	Cumulative  Temporality = "Cumulative"
)

func (t *Temporality) Scan(src interface{}) error {
	if src == nil {
		*t = ""
		return nil
	}

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Use exactly "builder", "clickhouse_sql", or "promql"
  2. Match the map you populate (BuilderQueries vs ClickHouseQueries vs PromQueries) to the queryType

Example fix

// before
{"queryType":"sql","clickHouseQueries":{...}}
// after
{"queryType":"clickhouse_sql","clickHouseQueries":{...}}
Defensive patterns

Strategy: type-guard

Validate before calling

switch c.QueryType { case v3.QueryTypeBuilder, v3.QueryTypeClickHouseSQL, v3.QueryTypePromQL: default: return errors.New("invalid query type") }

Type guard

func isValidQueryType(t v3.QueryType) bool { return t == v3.QueryTypeBuilder || t == v3.QueryTypeClickHouseSQL || t == v3.QueryTypePromQL }

Prevention

When it happens

Trigger: Passing queryType such as "cli", "sql", or omitting it while still including query maps.

Common situations: Version drift between frontend and query service, or hand-written payloads using informal names like "sql" instead of "clickhouse_sql".

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28). Data as JSON: /api/errors/8827ebe3f025d8da. Report an issue: GitHub.