{"record":{"id":"e95666d4eb3a71a9","repo":"SigNoz/signoz","slug":"invalid-data-source-w","errorCode":null,"errorMessage":"invalid data source: %w","messagePattern":"invalid data source: %w","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/query-service/model/v3/v3.go","lineNumber":352,"sourceCode":"\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 {\n\tAttributeKeys []AttributeKey `json:\"attributeKeys\"`\n}\n\ntype FilterAttributeKeyResponse struct {\n\tAttributeKeys []AttributeKey `json:\"attributeKeys\"`\n}","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/model/v3/v3.go#L334-L370","documentation":"FilterAttributeValueRequest.Validate() wraps the DataSource enum validation and prefixes it with 'invalid data source'. DataSource must be \"traces\", \"logs\", or \"metrics\"; anything else (including empty) fails here.","triggerScenarios":"POSTing the attribute_value request with dataSource \"spans\", \"traces\" (typo like \"trace\"), \"\", or omitted. The wrapped error from DataSource.Validate() is what this message carries.","commonSituations":"Confusing signal names (spans vs traces), older API payloads using different source names, or field omitted because a client assumed a default.","solutions":["Set dataSource to exactly \"traces\", \"logs\", or \"metrics\"","Check the wrapped error text — it will name the invalid value that failed DataSource.Validate()","For span attributes use \"traces\", not \"spans\""],"exampleFix":"// before\n{\"dataSource\":\"spans\",...}\n\n// after\n{\"dataSource\":\"traces\",...}","handlingStrategy":"validation","validationCode":"if err := req.DataSource.Validate(); err != nil { return fmt.Errorf(\"fix dataSource: %w\", err) }","typeGuard":"func isValidDataSource(d v3.DataSource) bool { return d == v3.DataSourceTraces || d == v3.DataSourceLogs || d == v3.DataSourceMetrics }","tryCatchPattern":null,"preventionTips":["Use exactly traces/logs/metrics","Surface the wrapped error text to spot the offending value"],"tags":["go","validation","enum","wrap","signoz"],"backgroundTag":"invalid-enum-value","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}