SigNoz/signoz · error

invalid attribute type

Error message

invalid attribute type: %s

What it means

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.

Solutions

  1. When isColumn is true, set type to "tag", "resource", "scope", or "unspecified"
  2. Prefer using server-returned AttributeKey objects (from autocomplete APIs) verbatim in filters so type/isColumn stay consistent
  3. If you don't need column semantics, set isColumn:false and omit type

Example fix

// before
{"key":"service.name","dataType":"string","isColumn":true,"type":""}

// after
{"key":"service.name","dataType":"string","isColumn":true,"type":"resource"}
Defensive patterns

Strategy: validation

Validate before calling

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) } }

Type guard

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 }

Prevention

When it happens

Trigger: 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.

Common situations: Marking user-selected attributes as columns while leaving type empty, mixing up TagType values with AttributeKeyType, or older payloads predating instrumentation-scope support.

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/3ff756b69dd47c21. Report an issue: GitHub.

Appendix: source

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

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
}

type FilterAttributeValueResponse struct {
	StringAttributeValues []string                      `json:"stringAttributeValues"`
	NumberAttributeValues []interface{}                 `json:"numberAttributeValues"`
	BoolAttributeValues   []bool                        `json:"boolAttributeValues"`
	RelatedValues         *FilterAttributeValueResponse `json:"relatedValues,omitempty"`
}

type QueryRangeParamsV3 struct {

View on GitHub (pinned to 5069bf80b0)