{"record":{"id":"8a0ffe048a8445e5","repo":"SigNoz/signoz","slug":"existingfilteritems-must-contain-a-valid-key","errorCode":null,"errorMessage":"existingFilterItems must contain a valid key","messagePattern":"existingFilterItems must contain a valid key","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/query-service/model/v3/v3.go","lineNumber":346,"sourceCode":"\t\treturn fmt.Errorf(\"startTimeMillis is required\")\n\t}\n\n\tif f.EndTimeMillis == 0 {\n\t\treturn fmt.Errorf(\"endTimeMillis is required\")\n\t}\n\n\tif f.Limit == 0 {\n\t\tf.Limit = 100\n\t}\n\n\tif f.Limit > 1000 {\n\t\treturn fmt.Errorf(\"limit must be less than 1000\")\n\t}\n\n\tif f.ExistingFilterItems != nil {\n\t\tfor _, value := range f.ExistingFilterItems {\n\t\t\tif value.Key.Key == \"\" {\n\t\t\t\treturn fmt.Errorf(\"existingFilterItems must contain a valid key\")\n\t\t\t}\n\t\t}\n\t}\n\n\tif err := f.DataSource.Validate(); err != nil {\n\t\treturn fmt.Errorf(\"invalid data source: %w\", err)\n\t}\n\n\tif f.DataSource != DataSourceMetrics {\n\t\tif err := f.AggregateOperator.Validate(); err != nil {\n\t\t\treturn fmt.Errorf(\"invalid aggregate operator: %w\", err)\n\t\t}\n\t}\n\n\treturn nil\n}\n\ntype AggregateAttributeResponse struct {","sourceCodeStart":328,"sourceCodeEnd":364,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/model/v3/v3.go#L328-L364","documentation":"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.","triggerScenarios":"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.","commonSituations":"Filter builder state serializing incomplete rows, clients reusing FilterItem structs where only Key was partially populated, migration code dropping the key field.","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"],"exampleFix":"// before\n\"existingFilterItems\":[{\"key\":{\"key\":\"\",\"dataType\":\"string\"},\"value\":\"x\",\"operator\":\"=\"}]\n\n// after\n\"existingFilterItems\":[{\"key\":{\"key\":\"http.method\",\"dataType\":\"string\"},\"value\":\"GET\",\"operator\":\"=\"}]","handlingStrategy":"validation","validationCode":"for _, it := range req.ExistingFilterItems { if it.Key.Key == \"\" { return errors.New(\"existingFilterItems contains empty key\") } }","typeGuard":"func existingFiltersComplete(items []v3.FilterItem) bool { for _, it := range items { if it.Key.Key == \"\" { return false } }; return true }","tryCatchPattern":null,"preventionTips":["Strip incomplete filter rows before serializing","Require attribute selection before a filter row becomes active"],"tags":["go","validation","filters","autocomplete","signoz"],"backgroundTag":"missing-required-field","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}