SigNoz/signoz · error
existingFilterItems must contain a valid key
Error message
existingFilterItems must contain a valid key
What it means
FilterAttributeValueRequest.Validate() iterates ExistingFilterItems and fails if any item's Key.Key is empty. Existing filters constrain the value search, and each must reference a real attribute key.
Source
Thrown at pkg/query-service/model/v3/v3.go:346
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")
}
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 {View on GitHub (pinned to 5069bf80b0)
Solutions
- Prune filter items whose Key.Key is empty before sending the request
- Ensure each existingFilterItems entry has a fully populated Key object with a non-empty key string
- Add client-side validation that a filter row is complete before it enters the request
Example fix
// before
"existingFilterItems":[{"key":{"key":"","dataType":"string"},"value":"x","operator":"="}]
// after
"existingFilterItems":[{"key":{"key":"http.method","dataType":"string"},"value":"GET","operator":"="}] Defensive patterns
Strategy: validation
Validate before calling
for _, it := range req.ExistingFilterItems { if it.Key.Key == "" { return errors.New("existingFilterItems contains empty key") } } Type guard
func existingFiltersComplete(items []v3.FilterItem) bool { for _, it := range items { if it.Key.Key == "" { return false } }; return true } Prevention
- Strip incomplete filter rows before serializing
- Require attribute selection before a filter row becomes active
When it happens
Trigger: Sending existingFilterItems in the attribute_value request where an entry has {"key":{"key":"","dataType":"string",...}} — e.g. a filter row added in the UI but with no attribute chosen yet, or a stale filter item with an empty key field.
Common situations: Filter builder state serializing incomplete rows, clients reusing FilterItem structs where only Key was partially populated, migration code dropping the key field.
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
- filterAttributeKey is required
- ErrCodeInvalidInput
- invalid value for key %s: %v
- unsupported operator %s
- invalid operator: %s
AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28).
Data as JSON: /api/errors/8a0ffe048a8445e5.
Report an issue: GitHub.