{"record":{"id":"a839e0ede49311d2","repo":"SigNoz/signoz","slug":"key-is-empty","errorCode":null,"errorMessage":"key is empty","messagePattern":"key is empty","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/query-service/model/v3/v3.go","lineNumber":416,"sourceCode":"func (a AttributeKey) Validate() error {\n\tswitch a.DataType {\n\tcase AttributeKeyDataTypeBool, AttributeKeyDataTypeInt64, AttributeKeyDataTypeFloat64, AttributeKeyDataTypeString, AttributeKeyDataTypeArrayFloat64, AttributeKeyDataTypeArrayString, AttributeKeyDataTypeArrayInt64, AttributeKeyDataTypeArrayBool, AttributeKeyDataTypeUnspecified:\n\t\tbreak\n\tdefault:\n\t\treturn fmt.Errorf(\"invalid attribute dataType: %s\", a.DataType)\n\t}\n\n\tif a.IsColumn {\n\t\tswitch a.Type {\n\t\tcase AttributeKeyTypeResource, AttributeKeyTypeTag, AttributeKeyTypeUnspecified, AttributeKeyTypeInstrumentationScope:\n\t\t\tbreak\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"invalid attribute type: %s\", a.Type)\n\t\t}\n\t}\n\n\tif a.Key == \"\" {\n\t\treturn fmt.Errorf(\"key is empty\")\n\t}\n\n\treturn nil\n}\n\ntype FilterAttributeValueResponse struct {\n\tStringAttributeValues []string                      `json:\"stringAttributeValues\"`\n\tNumberAttributeValues []interface{}                 `json:\"numberAttributeValues\"`\n\tBoolAttributeValues   []bool                        `json:\"boolAttributeValues\"`\n\tRelatedValues         *FilterAttributeValueResponse `json:\"relatedValues,omitempty\"`\n}\n\ntype QueryRangeParamsV3 struct {\n\tStart          int64                  `json:\"start\"`\n\tEnd            int64                  `json:\"end\"`\n\tStep           int64                  `json:\"step\"` // step is in seconds; used for prometheus queries\n\tCompositeQuery *CompositeQuery        `json:\"compositeQuery\"`\n\tVariables      map[string]interface{} `json:\"variables,omitempty\"`","sourceCodeStart":398,"sourceCodeEnd":434,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/model/v3/v3.go#L398-L434","documentation":"AttributeKey.Validate() requires the Key string itself to be non-empty; everything else (dataType, type) is meaningless without an attribute name to bind to.","triggerScenarios":"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.","commonSituations":"UI serializing a filter row before the user picks an attribute, struct field shadowing or typos (name vs key), default-constructed key objects.","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"],"exampleFix":"// before\n{\"key\":{\"key\":\"\",\"dataType\":\"string\"},\"value\":\"GET\",\"operator\":\"=\"}\n\n// after\n{\"key\":{\"key\":\"http.method\",\"dataType\":\"string\"},\"value\":\"GET\",\"operator\":\"=\"}","handlingStrategy":"validation","validationCode":"if key.Key == \"\" { return errors.New(\"attribute key name is empty\") }","typeGuard":"func hasKeyName(k v3.AttributeKey) bool { return strings.TrimSpace(k.Key) != \"\" }","tryCatchPattern":null,"preventionTips":["Validate filter rows are fully populated before submitting","Watch for JSON field mismatches when hand-building keys"],"tags":["go","validation","missing-field","attributes","query-builder"],"backgroundTag":"missing-required-field","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}