SigNoz/signoz · error

filterAttributeKey is required

Error message

filterAttributeKey is required

What it means

FilterAttributeValueRequest.Validate() requires FilterAttributeKey to be non-empty. This request fetches possible values for one attribute, so the attribute key is the mandatory anchor of the lookup.

Source

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

type FilterAttributeValueRequest struct {
	StartTimeMillis            int64                `json:"startTimeMillis"`
	EndTimeMillis              int64                `json:"endTimeMillis"`
	DataSource                 DataSource           `json:"dataSource"`
	AggregateOperator          AggregateOperator    `json:"aggregateOperator"`
	AggregateAttribute         string               `json:"aggregateAttribute"`
	FilterAttributeKey         string               `json:"filterAttributeKey"`
	FilterAttributeKeyDataType AttributeKeyDataType `json:"filterAttributeKeyDataType"`
	TagType                    TagType              `json:"tagType"`
	SearchText                 string               `json:"searchText"`
	Limit                      int                  `json:"limit"`
	ExistingFilterItems        []FilterItem         `json:"existingFilterItems"`
	MetricNames                []string             `json:"metricNames"`
	IncludeRelated             bool                 `json:"includeRelated"`
}

func (f *FilterAttributeValueRequest) Validate() error {
	if f.FilterAttributeKey == "" {
		return fmt.Errorf("filterAttributeKey is required")
	}

	if f.StartTimeMillis == 0 {
		return fmt.Errorf("startTimeMillis is required")
	}

	if f.EndTimeMillis == 0 {
		return fmt.Errorf("endTimeMillis is required")
	}

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

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

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Include the exact field filterAttributeKey with the attribute you want values for (e.g. "http.method")
  2. Guard the UI/caller so the request is only fired after an attribute key is selected
  3. Verify JSON casing matches the struct tags exactly (filterAttributeKey)

Example fix

// before
{"startTimeMillis":1700000000000,"endTimeMillis":1700003600000,"dataSource":"traces"}

// after
{"filterAttributeKey":"http.method","startTimeMillis":1700000000000,"endTimeMillis":1700003600000,"dataSource":"traces"}
Defensive patterns

Strategy: validation

Validate before calling

if strings.TrimSpace(req.FilterAttributeKey) == "" { return errors.New("select an attribute key before fetching values") }

Type guard

func hasFilterAttributeKey(r *v3.FilterAttributeValueRequest) bool { return r != nil && r.FilterAttributeKey != "" }

Prevention

When it happens

Trigger: Calling POST /api/v3/auto_complete/attribute_value (filterAttributeValue) with a JSON body missing the filterAttributeKey field, or with it set to "" — often when the user hasn't yet selected an attribute in the UI filter builder.

Common situations: Filter UI submitting before the user picks an attribute key, programmatic clients copying the request shape from another endpoint (e.g. aggregate attributes, where the key is optional) and dropping the field, or JSON field-name typos like filterAttributekey.

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