jaegertracing/jaeger · error
Field [%s]: Bucket [%s] could not be converted to float64 in
Error message
Field [%s]: Bucket [%s] could not be converted to float64 in 'buckets' string [%s]
What it means
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.
Source
Thrown at internal/metrics/metrics.go:88
switch {
case field.Type.AssignableTo(timerPtrType):
bucketValues := strings.Split(bucketString, ",")
for _, bucket := range bucketValues {
d, err := time.ParseDuration(bucket)
if err != nil {
return fmt.Errorf(
"Field [%s]: Bucket [%s] could not be parsed as duration in 'buckets' string [%s]",
field.Name, bucket, bucketString,
)
}
timerBuckets = append(timerBuckets, d)
}
case field.Type.AssignableTo(histogramPtrType):
bucketValues := strings.Split(bucketString, ",")
for _, bucket := range bucketValues {
b, err := strconv.ParseFloat(bucket, 64)
if err != nil {
return fmt.Errorf(
"Field [%s]: Bucket [%s] could not be converted to float64 in 'buckets' string [%s]",
field.Name, bucket, bucketString,
)
}
histogramBuckets = append(histogramBuckets, b)
}
default:
return fmt.Errorf(
"Field [%s]: Buckets should only be defined for Timer and Histogram metric types",
field.Name,
)
}
}
help := field.Tag.Get("help")
var obj any
switch {
case field.Type.AssignableTo(counterPtrType):
obj = factory.Counter(Options{View on GitHub (pinned to 806f444784)
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
Example fix
// before Size *Histogram `metric:"size" buckets:"1kb,10kb"` // after Size *Histogram `metric:"size" buckets:"1024,10240"`
Defensive patterns
Strategy: validation
Validate before calling
func checkHistogramBuckets(s string) error {
for _, b := range strings.Split(s, ",") {
if _, err := strconv.ParseFloat(b, 64); err != nil {
return fmt.Errorf("bad float bucket %q", b)
}
}
return nil
} Try / catch
if err := metrics.Init(&m); err != nil {
if strings.Contains(err.Error(), "could not be converted to float64") {
// replace the non-numeric bucket on the named field
}
return err
} Prevention
- 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"
When it happens
Trigger: 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.
Common situations: Mixing up timer-style duration buckets with histogram float buckets; pasting duration strings like '10ms' into a histogram buckets tag; stray commas.
Related errors
- Field %s is missing a tag 'metric'
- Field [%s]: Tag [%s] is not of the form key=value in 'tags'
- Field [%s]: Bucket [%s] could not be parsed as duration in '
- Field [%s]: Buckets should only be defined for Timer and His
- Field %s is not a pointer to timer, gauge, or counter
AI-assisted analysis of jaegertracing/jaeger@806f444784 (2026-09-01).
Data as JSON: /api/errors/3e2464c129da4cbe.
Report an issue: GitHub.