SigNoz/signoz · error

query is empty

Error message

query is empty

What it means

PromQuery.Validate() requires a non-empty Query string when a PromQueries entry is present in a composite query. It is invoked from CompositeQuery.Validate() when queryType is promql (or when prom queries are present).

Source

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

func (p *PromQuery) Clone() *PromQuery {
	if p == nil {
		return nil
	}
	return &PromQuery{
		Query:    p.Query,
		Stats:    p.Stats,
		Disabled: p.Disabled,
		Legend:   p.Legend,
	}
}

func (p *PromQuery) Validate() error {
	if p == nil {
		return nil
	}

	if p.Query == "" {
		return fmt.Errorf("query is empty")
	}

	return nil
}

type ClickHouseQuery struct {
	Query    string `json:"query"`
	Disabled bool   `json:"disabled"`
	Legend   string `json:"legend,omitempty"`
}

func (c *ClickHouseQuery) Clone() *ClickHouseQuery {
	if c == nil {
		return nil
	}
	return &ClickHouseQuery{
		Query:    c.Query,
		Disabled: c.Disabled,

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Set a real PromQL expression, e.g. query: "up" or "rate(http_requests_total[5m])"
  2. Skip adding the promQueries entry entirely if there's no expression
  3. Guard the UI so empty editor panels aren't serialized into the request

Example fix

// before
"promQueries":{"A":{"query":""}}

// after
"promQueries":{"A":{"query":"up"}}
Defensive patterns

Strategy: validation

Validate before calling

if cq.PromQueries != nil { for name, q := range cq.PromQueries { if q != nil && q.Query == "" { return fmt.Errorf("prom query %s is empty", name) } } }

Type guard

func promQueriesComplete(cq *v3.CompositeQuery) bool { for _, q := range cq.PromQueries { if q == nil || q.Query == "" { return false } }; return true }

Prevention

When it happens

Trigger: Submitting queryType "promql" with a promQueries map whose entry has an empty or missing query field, or sending blank query strings from an editor panel that hasn't been filled in.

Common situations: Dashboards created with an empty PromQL editor state, templating that renders to an empty string, or clients copying the composite-query skeleton and forgetting to populate each named query.

Understand the failure class

Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.

Related errors


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