{"record":{"id":"ab4a880d9f819849","repo":"jaegertracing/jaeger","slug":"unsupported-attribute-type-v-for-key-s","errorCode":null,"errorMessage":"unsupported attribute type %v for key %s","messagePattern":"unsupported attribute type (.+?) for key (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/v2/clickhouse/tracestore/query_builder.go","lineNumber":211,"sourceCode":"\t\t\targs = buildSimpleAttributeCondition(q, args, key, pcommon.ValueTypeDouble, attr.Double())\n\t\tcase pcommon.ValueTypeInt:\n\t\t\targs = buildSimpleAttributeCondition(q, args, key, pcommon.ValueTypeInt, attr.Int())\n\t\tcase pcommon.ValueTypeStr:\n\t\t\targs = buildStringAttributeCondition(q, args, key, attr, metadata)\n\t\tcase pcommon.ValueTypeBytes:\n\t\t\targs = buildBytesAttributeCondition(q, args, key, attr)\n\t\tcase pcommon.ValueTypeSlice:\n\t\t\targs, err = buildSliceAttributeCondition(q, args, key, attr)\n\t\t\tif err != nil {\n\t\t\t\treturn args, err\n\t\t\t}\n\t\tcase pcommon.ValueTypeMap:\n\t\t\targs, err = buildMapAttributeCondition(q, args, key, attr)\n\t\t\tif err != nil {\n\t\t\t\treturn args, err\n\t\t\t}\n\t\tdefault:\n\t\t\treturn args, fmt.Errorf(\"unsupported attribute type %v for key %s\", attr.Type(), key)\n\t\t}\n\n\t\tappendNewlineAndIndent(q, 1)\n\t\tq.WriteString(\")\")\n\t}\n\n\treturn args, nil\n}\n\nfunc buildSimpleAttributeCondition(q *strings.Builder, args []any, key string, valueType pcommon.ValueType, value any) []any {\n\tappendArrayExists(q, 2, \"\", valueType)\n\tappendNewlineAndIndent(q, 2)\n\tq.WriteString(\"OR\")\n\tappendArrayExists(q, 2, \"resource\", valueType)\n\tappendNewlineAndIndent(q, 2)\n\tq.WriteString(\"OR\")\n\tappendArrayExists(q, 2, \"scope\", valueType)\n\tappendNewlineAndIndent(q, 2)","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/internal/storage/v2/clickhouse/tracestore/query_builder.go#L193-L229","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Only pass supported scalar (string/int/float/bool/bytes), slice, or map attributes in the query","Filter out pcommon.ValueTypeEmpty attributes before calling FindTraceIDs","Update the query builder to handle the new value type if one was recently added","Log the offending attribute type and key to locate the caller sending it"],"exampleFix":"// before\nattrs.Insert(\"k\", pcommon.NewValueEmpty())\n// after: only supported types\nif attr.Type() != pcommon.ValueTypeEmpty {\n    attrs.PutStr(\"k\", attr.AsString())\n}","handlingStrategy":"validation","validationCode":"func supportedQueryAttrs(attrs pcommon.Map) error {\n    var err error\n    attrs.Range(func(k string, v pcommon.Value) bool {\n        switch v.Type() {\n        case pcommon.ValueTypeStr, pcommon.ValueTypeInt, pcommon.ValueTypeDouble,\n            pcommon.ValueTypeBool, pcommon.ValueTypeBytes, pcommon.ValueTypeSlice,\n            pcommon.ValueTypeMap:\n            return true\n        default:\n            err = fmt.Errorf(\"unsupported attribute type %v for key %s\", v.Type(), k)\n            return false\n        }\n    })\n    return err\n}","typeGuard":"func isSupportedAttrType(t pcommon.ValueType) bool {\n    switch t {\n    case pcommon.ValueTypeStr, pcommon.ValueTypeInt, pcommon.ValueTypeDouble,\n        pcommon.ValueTypeBool, pcommon.ValueTypeBytes, pcommon.ValueTypeSlice,\n        pcommon.ValueTypeMap:\n        return true\n    }\n    return false\n}","tryCatchPattern":"if err := supportedQueryAttrs(query.Attributes); err != nil {\n    return fmt.Errorf(\"refusing search: %w\", err)\n}\ntraceIDs, err := store.FindTraceIDs(ctx, query)","preventionTips":["Only query with scalar, slice, or map attribute values","Drop or stringify empty-value attributes before searching","Keep the query builder's type switch in sync with pcommon versions"],"tags":["clickhouse","query-builder","attribute-types","validation"],"backgroundTag":"unsupported-attribute-type","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}