{"record":{"id":"3e2464c129da4cbe","repo":"jaegertracing/jaeger","slug":"field-s-bucket-s-could-not-be-converted-to","errorCode":null,"errorMessage":"Field [%s]: Bucket [%s] could not be converted to float64 in 'buckets' string [%s]","messagePattern":"Field \\[(.+?)\\]: Bucket \\[(.+?)\\] could not be converted to float64 in 'buckets' string \\[(.+?)\\]","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/metrics/metrics.go","lineNumber":88,"sourceCode":"\t\t\tswitch {\n\t\t\tcase field.Type.AssignableTo(timerPtrType):\n\t\t\t\tbucketValues := strings.Split(bucketString, \",\")\n\t\t\t\tfor _, bucket := range bucketValues {\n\t\t\t\t\td, err := time.ParseDuration(bucket)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\t\t\"Field [%s]: Bucket [%s] could not be parsed as duration in 'buckets' string [%s]\",\n\t\t\t\t\t\t\tfield.Name, bucket, bucketString,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\ttimerBuckets = append(timerBuckets, d)\n\t\t\t\t}\n\t\t\tcase field.Type.AssignableTo(histogramPtrType):\n\t\t\t\tbucketValues := strings.Split(bucketString, \",\")\n\t\t\t\tfor _, bucket := range bucketValues {\n\t\t\t\t\tb, err := strconv.ParseFloat(bucket, 64)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\t\t\"Field [%s]: Bucket [%s] could not be converted to float64 in 'buckets' string [%s]\",\n\t\t\t\t\t\t\tfield.Name, bucket, bucketString,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\thistogramBuckets = append(histogramBuckets, b)\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\"Field [%s]: Buckets should only be defined for Timer and Histogram metric types\",\n\t\t\t\t\tfield.Name,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t\thelp := field.Tag.Get(\"help\")\n\t\tvar obj any\n\t\tswitch {\n\t\tcase field.Type.AssignableTo(counterPtrType):\n\t\t\tobj = factory.Counter(Options{","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/internal/metrics/metrics.go#L70-L106","documentation":"metrics.Init() parses the `buckets` tag for *Histogram fields by splitting on commas and calling strconv.ParseFloat(bucket, 64). An entry that is not a valid base-10 float triggers this error naming the field, the bucket, and the full buckets string.","triggerScenarios":"A *Histogram field with `buckets:\"...\"` containing a non-numeric entry, e.g. `buckets:\"0.1,high,1.0\"` or an empty segment from a trailing comma.","commonSituations":"Mixing up timer-style duration buckets with histogram float buckets; pasting duration strings like '10ms' into a histogram buckets tag; stray commas.","solutions":["Replace the offending entry with a valid float (e.g. '0.1', '1e3')","Remove duration units from histogram bucket values","Remove empty segments and stray commas","Check the field type: duration buckets belong on *Timer, floats on *Histogram"],"exampleFix":"// before\nSize *Histogram `metric:\"size\" buckets:\"1kb,10kb\"`\n// after\nSize *Histogram `metric:\"size\" buckets:\"1024,10240\"`","handlingStrategy":"validation","validationCode":"func checkHistogramBuckets(s string) error {\n    for _, b := range strings.Split(s, \",\") {\n        if _, err := strconv.ParseFloat(b, 64); err != nil {\n            return fmt.Errorf(\"bad float bucket %q\", b)\n        }\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err := metrics.Init(&m); err != nil {\n    if strings.Contains(err.Error(), \"could not be converted to float64\") {\n        // replace the non-numeric bucket on the named field\n    }\n    return err\n}","preventionTips":["Histogram buckets must be plain floats — no units, no durations","Do not share bucket tag strings between Timer and Histogram fields","Strip commas/whitespace from entries","Precompute bucket strings like \"0.001,0.01,0.1,1\""],"tags":["reflection","struct-tags","metrics","float-parsing"],"backgroundTag":"invalid-bucket-spec","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}