SigNoz/signoz · error
key is empty
Error message
key is empty
What it means
AttributeKey.Validate() requires the Key string itself to be non-empty; everything else (dataType, type) is meaningless without an attribute name to bind to.
Source
Thrown at pkg/query-service/model/v3/v3.go:416
func (a AttributeKey) Validate() error {
switch a.DataType {
case AttributeKeyDataTypeBool, AttributeKeyDataTypeInt64, AttributeKeyDataTypeFloat64, AttributeKeyDataTypeString, AttributeKeyDataTypeArrayFloat64, AttributeKeyDataTypeArrayString, AttributeKeyDataTypeArrayInt64, AttributeKeyDataTypeArrayBool, AttributeKeyDataTypeUnspecified:
break
default:
return fmt.Errorf("invalid attribute dataType: %s", a.DataType)
}
if a.IsColumn {
switch a.Type {
case AttributeKeyTypeResource, AttributeKeyTypeTag, AttributeKeyTypeUnspecified, AttributeKeyTypeInstrumentationScope:
break
default:
return fmt.Errorf("invalid attribute type: %s", a.Type)
}
}
if a.Key == "" {
return fmt.Errorf("key is empty")
}
return nil
}
type FilterAttributeValueResponse struct {
StringAttributeValues []string `json:"stringAttributeValues"`
NumberAttributeValues []interface{} `json:"numberAttributeValues"`
BoolAttributeValues []bool `json:"boolAttributeValues"`
RelatedValues *FilterAttributeValueResponse `json:"relatedValues,omitempty"`
}
type QueryRangeParamsV3 struct {
Start int64 `json:"start"`
End int64 `json:"end"`
Step int64 `json:"step"` // step is in seconds; used for prometheus queries
CompositeQuery *CompositeQuery `json:"compositeQuery"`
Variables map[string]interface{} `json:"variables,omitempty"`View on GitHub (pinned to 5069bf80b0)
Solutions
- Ensure every filter/group-by key object has a non-empty key string (e.g. "http.method")
- Validate filter rows client-side for completeness before building the request
- Check for JSON field-name mismatches if you're constructing keys manually
Example fix
// before
{"key":{"key":"","dataType":"string"},"value":"GET","operator":"="}
// after
{"key":{"key":"http.method","dataType":"string"},"value":"GET","operator":"="} Defensive patterns
Strategy: validation
Validate before calling
if key.Key == "" { return errors.New("attribute key name is empty") } Type guard
func hasKeyName(k v3.AttributeKey) bool { return strings.TrimSpace(k.Key) != "" } Prevention
- Validate filter rows are fully populated before submitting
- Watch for JSON field mismatches when hand-building keys
When it happens
Trigger: A FilterItem or aggregate attribute in a /api/v3 query payload where the key object is present but its key field is "" — e.g. an incomplete filter row or a JSON path bug writing the attribute name to the wrong property.
Common situations: UI serializing a filter row before the user picks an attribute, struct field shadowing or typos (name vs key), default-constructed key objects.
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
- invalid attribute type: %s
- invalid operator: %s
- invalid reduce to operator: %s
- invalid query type: %s
- filterAttributeKey is required
AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28).
Data as JSON: /api/errors/a839e0ede49311d2.
Report an issue: GitHub.