jaegertracing/jaeger · error

unsupported attribute type %v for key %s

Error message

unsupported attribute type %v for key %s

What it means

buildAttributeConditions rejects attribute values whose pcommon.ValueType has no mapping to a ClickHouse condition builder. Only scalar types, slices, and maps are supported; any other type (or an unset/invalid value) produces this error.

Source

Thrown at internal/storage/v2/clickhouse/tracestore/query_builder.go:211

			args = buildSimpleAttributeCondition(q, args, key, pcommon.ValueTypeDouble, attr.Double())
		case pcommon.ValueTypeInt:
			args = buildSimpleAttributeCondition(q, args, key, pcommon.ValueTypeInt, attr.Int())
		case pcommon.ValueTypeStr:
			args = buildStringAttributeCondition(q, args, key, attr, metadata)
		case pcommon.ValueTypeBytes:
			args = buildBytesAttributeCondition(q, args, key, attr)
		case pcommon.ValueTypeSlice:
			args, err = buildSliceAttributeCondition(q, args, key, attr)
			if err != nil {
				return args, err
			}
		case pcommon.ValueTypeMap:
			args, err = buildMapAttributeCondition(q, args, key, attr)
			if err != nil {
				return args, err
			}
		default:
			return args, fmt.Errorf("unsupported attribute type %v for key %s", attr.Type(), key)
		}

		appendNewlineAndIndent(q, 1)
		q.WriteString(")")
	}

	return args, nil
}

func buildSimpleAttributeCondition(q *strings.Builder, args []any, key string, valueType pcommon.ValueType, value any) []any {
	appendArrayExists(q, 2, "", valueType)
	appendNewlineAndIndent(q, 2)
	q.WriteString("OR")
	appendArrayExists(q, 2, "resource", valueType)
	appendNewlineAndIndent(q, 2)
	q.WriteString("OR")
	appendArrayExists(q, 2, "scope", valueType)
	appendNewlineAndIndent(q, 2)

View on GitHub (pinned to 806f444784)

Solutions

  1. Only pass supported scalar (string/int/float/bool/bytes), slice, or map attributes in the query
  2. Filter out pcommon.ValueTypeEmpty attributes before calling FindTraceIDs
  3. Update the query builder to handle the new value type if one was recently added
  4. Log the offending attribute type and key to locate the caller sending it

Example fix

// before
attrs.Insert("k", pcommon.NewValueEmpty())
// after: only supported types
if attr.Type() != pcommon.ValueTypeEmpty {
    attrs.PutStr("k", attr.AsString())
}
Defensive patterns

Strategy: validation

Validate before calling

func supportedQueryAttrs(attrs pcommon.Map) error {
    var err error
    attrs.Range(func(k string, v pcommon.Value) bool {
        switch v.Type() {
        case pcommon.ValueTypeStr, pcommon.ValueTypeInt, pcommon.ValueTypeDouble,
            pcommon.ValueTypeBool, pcommon.ValueTypeBytes, pcommon.ValueTypeSlice,
            pcommon.ValueTypeMap:
            return true
        default:
            err = fmt.Errorf("unsupported attribute type %v for key %s", v.Type(), k)
            return false
        }
    })
    return err
}

Type guard

func isSupportedAttrType(t pcommon.ValueType) bool {
    switch t {
    case pcommon.ValueTypeStr, pcommon.ValueTypeInt, pcommon.ValueTypeDouble,
        pcommon.ValueTypeBool, pcommon.ValueTypeBytes, pcommon.ValueTypeSlice,
        pcommon.ValueTypeMap:
        return true
    }
    return false
}

Try / catch

if err := supportedQueryAttrs(query.Attributes); err != nil {
    return fmt.Errorf("refusing search: %w", err)
}
traceIDs, err := store.FindTraceIDs(ctx, query)

Prevention

When it happens

Trigger: FindTraceIDs is called with a search attribute whose pcommon.Value.Type() is not one of the handled cases — typically pcommon.ValueTypeEmpty or an internally invalid value constructed programmatically.

Common situations: Constructing query attributes dynamically from user input and passing unsupported composite/empty values; upstream library version changes introducing new value types not yet handled by the builder.

Related errors


AI-assisted analysis of jaegertracing/jaeger@806f444784 (2026-09-01). Data as JSON: /api/errors/ab4a880d9f819849. Report an issue: GitHub.