{"record":{"id":"3ff756b69dd47c21","repo":"SigNoz/signoz","slug":"invalid-attribute-type-s","errorCode":null,"errorMessage":"invalid attribute type: %s","messagePattern":"invalid attribute type: (.+?)","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/query-service/model/v3/v3.go","lineNumber":411,"sourceCode":"\nfunc (a AttributeKey) CacheKey() string {\n\treturn fmt.Sprintf(\"%s-%s-%s-%t\", a.Key, a.DataType, a.Type, a.IsColumn)\n}\n\nfunc (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 {","sourceCodeStart":393,"sourceCodeEnd":429,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/model/v3/v3.go#L393-L429","documentation":"AttributeKey.Validate() checks Type only when IsColumn is true, and fails unless it is \"resource\" (AttributeKeyTypeResource), \"tag\" (AttributeKeyTypeTag), \"unspecified\", or \"scope\" (AttributeKeyTypeInstrumentationScope). Column-typed keys must declare which attribute namespace they come from so the query builder can resolve the ClickHouse column.","triggerScenarios":"Sending a builder query where a filter/group-by key has isColumn:true and type set to \"span\", \"metric\", \"\", or another invalid value. Keys with isColumn:false skip this check entirely.","commonSituations":"Marking user-selected attributes as columns while leaving type empty, mixing up TagType values with AttributeKeyType, or older payloads predating instrumentation-scope support.","solutions":["When isColumn is true, set type to \"tag\", \"resource\", \"scope\", or \"unspecified\"","Prefer using server-returned AttributeKey objects (from autocomplete APIs) verbatim in filters so type/isColumn stay consistent","If you don't need column semantics, set isColumn:false and omit type"],"exampleFix":"// before\n{\"key\":\"service.name\",\"dataType\":\"string\",\"isColumn\":true,\"type\":\"\"}\n\n// after\n{\"key\":\"service.name\",\"dataType\":\"string\",\"isColumn\":true,\"type\":\"resource\"}","handlingStrategy":"validation","validationCode":"if key.IsColumn { switch key.Type { case v3.AttributeKeyTypeResource, v3.AttributeKeyTypeTag, v3.AttributeKeyTypeUnspecified, v3.AttributeKeyTypeInstrumentationScope: default: return fmt.Errorf(\"bad key type %q\", key.Type) } }","typeGuard":"func columnKeyHasValidType(k v3.AttributeKey) bool { return !k.IsColumn || k.Type == v3.AttributeKeyTypeResource || k.Type == v3.AttributeKeyTypeTag || k.Type == v3.AttributeKeyTypeUnspecified || k.Type == v3.AttributeKeyTypeInstrumentationScope }","tryCatchPattern":null,"preventionTips":["Only set isColumn:true for keys the server flagged as columns","Copy type from the server's attribute metadata"],"tags":["go","validation","enum","attributes","query-builder"],"backgroundTag":"invalid-enum-value","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}