SigNoz/signoz · error

invalid data source: %w

Error message

invalid data source: %w

What it means

FilterAttributeValueRequest.Validate() wraps the DataSource enum validation and prefixes it with 'invalid data source'. DataSource must be "traces", "logs", or "metrics"; anything else (including empty) fails here.

Source

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

	if f.Limit == 0 {
		f.Limit = 100
	}

	if f.Limit > 1000 {
		return fmt.Errorf("limit must be less than 1000")
	}

	if f.ExistingFilterItems != nil {
		for _, value := range f.ExistingFilterItems {
			if value.Key.Key == "" {
				return fmt.Errorf("existingFilterItems must contain a valid key")
			}
		}
	}

	if err := f.DataSource.Validate(); err != nil {
		return fmt.Errorf("invalid data source: %w", err)
	}

	if f.DataSource != DataSourceMetrics {
		if err := f.AggregateOperator.Validate(); err != nil {
			return fmt.Errorf("invalid aggregate operator: %w", err)
		}
	}

	return nil
}

type AggregateAttributeResponse struct {
	AttributeKeys []AttributeKey `json:"attributeKeys"`
}

type FilterAttributeKeyResponse struct {
	AttributeKeys []AttributeKey `json:"attributeKeys"`
}

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Set dataSource to exactly "traces", "logs", or "metrics"
  2. Check the wrapped error text — it will name the invalid value that failed DataSource.Validate()
  3. For span attributes use "traces", not "spans"

Example fix

// before
{"dataSource":"spans",...}

// after
{"dataSource":"traces",...}
Defensive patterns

Strategy: validation

Validate before calling

if err := req.DataSource.Validate(); err != nil { return fmt.Errorf("fix dataSource: %w", err) }

Type guard

func isValidDataSource(d v3.DataSource) bool { return d == v3.DataSourceTraces || d == v3.DataSourceLogs || d == v3.DataSourceMetrics }

Prevention

When it happens

Trigger: POSTing the attribute_value request with dataSource "spans", "traces" (typo like "trace"), "", or omitted. The wrapped error from DataSource.Validate() is what this message carries.

Common situations: Confusing signal names (spans vs traces), older API payloads using different source names, or field omitted because a client assumed a default.

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