{"record":{"id":"1a27f4b6159cd77b","repo":"jaegertracing/jaeger","slug":"failed-to-parse-double-attribute-q-w","errorCode":null,"errorMessage":"failed to parse double attribute %q: %w","messagePattern":"failed to parse double attribute %q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/v2/clickhouse/tracestore/query_builder.go","lineNumber":269,"sourceCode":"\tb, err := marshalValueForQuery(attr)\n\tif err != nil {\n\t\treturn args, fmt.Errorf(\"failed to marshal map attribute %q: %w\", key, err)\n\t}\n\treturn buildSimpleAttributeCondition(q, args, \"@map@\"+key, pcommon.ValueTypeMap, b), nil\n}\n\nfunc parseStringToTypedValue(key string, attr pcommon.Value, t pcommon.ValueType) (typedAttributeValue, error) {\n\tswitch t {\n\tcase pcommon.ValueTypeBool:\n\t\tb, parseErr := strconv.ParseBool(attr.Str())\n\t\tif parseErr != nil {\n\t\t\treturn typedAttributeValue{}, fmt.Errorf(\"failed to parse bool attribute %q: %w\", key, parseErr)\n\t\t}\n\t\treturn typedAttributeValue{key: key, value: b, valueType: t}, nil\n\tcase pcommon.ValueTypeDouble:\n\t\tf, parseErr := strconv.ParseFloat(attr.Str(), 64)\n\t\tif parseErr != nil {\n\t\t\treturn typedAttributeValue{}, fmt.Errorf(\"failed to parse double attribute %q: %w\", key, parseErr)\n\t\t}\n\t\treturn typedAttributeValue{key: key, value: f, valueType: t}, nil\n\tcase pcommon.ValueTypeInt:\n\t\ti, parseErr := strconv.ParseInt(attr.Str(), 10, 64)\n\t\tif parseErr != nil {\n\t\t\treturn typedAttributeValue{}, fmt.Errorf(\"failed to parse int attribute %q: %w\", key, parseErr)\n\t\t}\n\t\treturn typedAttributeValue{key: key, value: i, valueType: t}, nil\n\tcase pcommon.ValueTypeStr:\n\t\treturn typedAttributeValue{key: key, value: attr.Str(), valueType: t}, nil\n\tcase pcommon.ValueTypeBytes:\n\t\treturn typedAttributeValue{key: \"@bytes@\" + key, value: attr.Str(), valueType: t}, nil\n\tcase pcommon.ValueTypeMap:\n\t\treturn typedAttributeValue{key: \"@map@\" + key, value: attr.Str(), valueType: t}, nil\n\tcase pcommon.ValueTypeSlice:\n\t\treturn typedAttributeValue{key: \"@slice@\" + key, value: attr.Str(), valueType: t}, nil\n\tdefault:\n\t\treturn typedAttributeValue{}, fmt.Errorf(\"unsupported attribute type %v for key %q\", t, key)","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/internal/storage/v2/clickhouse/tracestore/query_builder.go#L251-L287","documentation":"parseStringToTypedValue throws this when an attribute declared as pcommon.ValueTypeDouble is stored as a string that strconv.ParseFloat cannot convert to a float64. Because string-backed storage requires conversion before the value can be bound into a ClickHouse query, an unparseable string aborts query construction and the underlying strconv error is wrapped with %w for context.","triggerScenarios":"A query condition targets an attribute whose metadata type is Double but whose stored string value is not a valid float literal — e.g. \"1,5\" (locale decimal comma), \"12%\", \"\", \"Infinity\"-style text, or a value carrying units like \"3.5ms\".","commonSituations":"Metrics-like values emitted with units or locale formatting; CSV/import pipelines writing human-formatted numbers; a type change in attribute_metadata from string to double without backfilling values; SDK upgrades that reclassify an attribute as double.","solutions":["Correct the stored string value to a valid float64 literal (use '.' as decimal separator, no units/symbols)","Fix attribute_metadata so the key's declared type matches the actual stored representation","Normalize the emitting instrumentations to send numeric attribute values","Pre-clean data during migration/import so numeric columns contain parseable literals"],"exampleFix":"// before\n{\"key\": \"duration_ms\", \"type\": \"double\", \"string_value\": \"12.5ms\"}\n// after\n{\"key\": \"duration_ms\", \"type\": \"double\", \"string_value\": \"12.5\"}","handlingStrategy":"validation","validationCode":"// validate double attribute strings before querying\nfunc validFloatAttr(s string) bool {\n\t_, err := strconv.ParseFloat(s, 64)\n\treturn err == nil\n}","typeGuard":"func isDoubleTyped(v pcommon.Value) bool { return v.Type() == pcommon.ValueTypeDouble }","tryCatchPattern":"if err != nil {\n\tif strings.Contains(err.Error(), \"failed to parse double attribute\") {\n\t\t// re-issue the query dropping the numeric condition, or coerce on write\n\t}\n\treturn err\n}","preventionTips":["Never attach units or locale formatting to numeric attribute values","Use strconv.FormatFloat when persisting numbers as strings","Validate numeric attributes in the collector pipeline before storage","Keep attribute_metadata types in sync with actual stored representations during migrations"],"tags":["clickhouse","attributes","type-conversion","query-builder"],"backgroundTag":"attribute-type-parse-failed","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}