SigNoz/signoz · error

invalid space aggregation: %s

Error message

invalid space aggregation: %s

What it means

Thrown by SpaceAggregation.Validate when the space aggregation value is not in the permitted set (noop through percentile99 and rate variants).

Source

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

	SpaceAggregationPercentile95 SpaceAggregation = "p95"
	SpaceAggregationPercentile99 SpaceAggregation = "p99"
)

func (s SpaceAggregation) Validate() error {
	switch s {
	case SpaceAggregationSum,
		SpaceAggregationAvg,
		SpaceAggregationMin,
		SpaceAggregationMax,
		SpaceAggregationCount,
		SpaceAggregationPercentile50,
		SpaceAggregationPercentile75,
		SpaceAggregationPercentile90,
		SpaceAggregationPercentile95,
		SpaceAggregationPercentile99:
		return nil
	default:
		return fmt.Errorf("invalid space aggregation: %s", s)
	}
}

func IsPercentileOperator(operator SpaceAggregation) bool {
	switch operator {
	case SpaceAggregationPercentile50,
		SpaceAggregationPercentile75,
		SpaceAggregationPercentile90,
		SpaceAggregationPercentile95,
		SpaceAggregationPercentile99:
		return true
	default:
		return false
	}
}

func GetPercentileFromOperator(operator SpaceAggregation) float64 {
	// This could be done with a map, but it's just easier to read this way

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Use exact values from the SpaceAggregation constants
  2. Upgrade query service if the value was added in a newer release
  3. Validate enum client-side against a generated list

Example fix

// before
"spaceAggregation":"percentile95"
// after
"spaceAggregation":"p95"
Defensive patterns

Strategy: type-guard

Validate before calling

if q.SpaceAggregation != "" { if err := q.SpaceAggregation.Validate(); err != nil { return err } }

Type guard

func isValidSpaceAgg(s v3.SpaceAggregation) bool { return s.Validate() == nil }

Prevention

When it happens

Trigger: Setting spaceAggregation to a value outside the allowed set (sum, avg, min, max, p25/p50/p75/p90/p95/p99, count_distinct, rate_sum, rate_avg, rate_max, rate_min).

Common situations: Frontend/backend version mismatch on newly added space aggregations, or typos like "percentile95" instead of "p95".

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