SigNoz/signoz · error

invalid time aggregation: %s

Error message

invalid time aggregation: %s

What it means

Thrown by TimeAggregation.Validate when the time aggregation string is not in the allowed set (noop, count, count_distinct, sum, min, max, avg, rate, increase, etc.).

Source

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

	TimeAggregationCountDistinct TimeAggregation = "count_distinct"
	TimeAggregationRate          TimeAggregation = "rate"
	TimeAggregationIncrease      TimeAggregation = "increase"
)

func (t TimeAggregation) Validate() error {
	switch t {
	case TimeAggregationAnyLast,
		TimeAggregationSum,
		TimeAggregationAvg,
		TimeAggregationMin,
		TimeAggregationMax,
		TimeAggregationCount,
		TimeAggregationCountDistinct,
		TimeAggregationRate,
		TimeAggregationIncrease:
		return nil
	default:
		return fmt.Errorf("invalid time aggregation: %s", t)
	}
}

func (t TimeAggregation) IsRateOperator() bool {
	switch t {
	case TimeAggregationRate, TimeAggregationIncrease:
		return true
	default:
		return false
	}
}

type MetricType string

const (
	MetricTypeUnspecified          MetricType = ""
	MetricTypeSum                  MetricType = "Sum"
	MetricTypeGauge                MetricType = "Gauge"

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Use exact snake_case values from the TimeAggregation constants in v3.go
  2. Upgrade SigNoz query service to the version whose enum set includes your value
  3. Map user-friendly names to constants before building the payload

Example fix

// before
"timeAggregation":"average"
// after
"timeAggregation":"avg"
Defensive patterns

Strategy: type-guard

Validate before calling

if err := q.TimeAggregation.Validate(); err != nil { return err } // client-side pre-check

Type guard

func isValidTimeAgg(t v3.TimeAggregation) bool { return t.Validate() == nil }

Prevention

When it happens

Trigger: Setting BuilderQuery.TimeAggregation to an unrecognized value like "average" or "sum_rate" via the v3 builder payload.

Common situations: Newer frontend emitting a time aggregation the deployed server doesn't recognize, or manual payload construction with guessed enum names.

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/2d80a0a1cf4c3d45. Report an issue: GitHub.