SigNoz/signoz · error

invalid attribute dataType: %s

Error message

invalid attribute dataType: %s

What it means

AttributeKey.Validate() rejects a DataType outside the full supported set, which includes scalars (bool, int64, float64, string, unspecified) AND array types (arrayBool, arrayInt64, arrayFloat64, arrayString). This is the wider type set used for filter keys inside query payloads.

Source

Thrown at pkg/query-service/model/v3/v3.go:403

type AttributeKey struct {
	Key      string               `json:"key"`
	DataType AttributeKeyDataType `json:"dataType"`
	Type     AttributeKeyType     `json:"type"`
	IsColumn bool                 `json:"isColumn"`
	IsJSON   bool                 `json:"isJSON"`
}

func (a AttributeKey) CacheKey() string {
	return fmt.Sprintf("%s-%s-%s-%t", a.Key, a.DataType, a.Type, a.IsColumn)
}

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
}

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Use exact enum strings: "bool", "int64", "float64", "string", "unspecified", "arrayBool", "arrayInt64", "arrayFloat64", "arrayString"
  2. Map JS types: number→"float64"/"int64", string[]→"arrayString"
  3. When receiving keys from the server's own autocomplete APIs, pass their dataType through unchanged

Example fix

// before
{"key":"tags","dataType":"array","value":["a"]}

// after
{"key":"tags","dataType":"arrayString","value":["a"]}
Defensive patterns

Strategy: validation

Validate before calling

switch key.DataType { case v3.AttributeKeyDataTypeBool, v3.AttributeKeyDataTypeInt64, v3.AttributeKeyDataTypeFloat64, v3.AttributeKeyDataTypeString, v3.AttributeKeyDataTypeArrayFloat64, v3.AttributeKeyDataTypeArrayString, v3.AttributeKeyDataTypeArrayInt64, v3.AttributeKeyDataTypeArrayBool, v3.AttributeKeyDataTypeUnspecified: default: return fmt.Errorf("bad dataType %q", key.DataType) }

Type guard

func isValidAttributeKeyDataType(d v3.AttributeKeyDataType) bool { switch d { case v3.AttributeKeyDataTypeBool, v3.AttributeKeyDataTypeInt64, v3.AttributeKeyDataTypeFloat64, v3.AttributeKeyDataTypeString, v3.AttributeKeyDataTypeArrayFloat64, v3.AttributeKeyDataTypeArrayString, v3.AttributeKeyDataTypeArrayInt64, v3.AttributeKeyDataTypeArrayBool, v3.AttributeKeyDataTypeUnspecified: return true }; return false }

Prevention

When it happens

Trigger: Building a FilterItem or expression whose key has dataType like "number", "array", "datetime", or "" inside a /api/v3/query_range builder request; AttributeKey.Validate() is called during BuilderQuery validation.

Common situations: Frontends mapping JS types directly, payloads from older API versions without array types, or copy-pasted dataType values from the autocomplete endpoints that use different spellings.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28). Data as JSON: /api/errors/472b7a3b45bc1956. Report an issue: GitHub.