SigNoz/signoz · error

error while scanning le: %s

Error message

error while scanning le: %s

What it means

Scan error while reading the 'le' (less-than-or-equal) bucket boundary column from histogram query results. It means the ClickHouse result row shape doesn't match the single-string scan target — e.g. le stored as a Float64/Array instead of String, or a NULL value.

Source

Thrown at pkg/query-service/app/clickhouseReader/reader.go:3316

			WHERE metric_name = $1
				AND unix_milli >= $2
				AND type = 'Histogram'
				AND (JSONExtractString(labels, 'service_name') = $3 OR JSONExtractString(labels, 'service.name') = $4)
			GROUP BY le
			ORDER BY le`, signozMetricDBName, signozTSTableNameV41Day)
		}

		rows, err := r.db.Query(ctx, query, metricName, unixMilli, serviceName, serviceName)
		if err != nil {
			r.logger.Error("Error while querying histogram buckets", errorsV2.Attr(err))
			return nil, fmt.Errorf("error while querying histogram buckets: %s", err.Error())
		}
		defer rows.Close()

		for rows.Next() {
			var leStr string
			if err := rows.Scan(&leStr); err != nil {
				return nil, fmt.Errorf("error while scanning le: %s", err.Error())
			}
			le, err := strconv.ParseFloat(leStr, 64)
			if err != nil || math.IsInf(le, 0) {
				r.logger.Error("Invalid 'le' bucket value", "value", leStr, errorsV2.Attr(err))
				continue
			}
			leFloat64 = append(leFloat64, le)
		}
	}

	return &v3.MetricMetadataResponse{
		Delta:       deltaExists,
		Le:          leFloat64,
		Description: description,
		Unit:        unit,
		Type:        metricType,
		IsMonotonic: isMonotonic,
		Temporality: temporality,

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Check the wrapped error for type-mismatch vs NULL indication
  2. Inspect the actual column type: DESCRIBE signoz_metrics.time_series_v4_1_day
  3. Re-run migrations so the histogram table schema matches the query-service version
  4. Scan into sql.NullString or interface{} and convert defensively

Example fix

// before
var leStr string
if err := rows.Scan(&leStr); err != nil { ... }

// after
var leStr sql.NullString
if err := rows.Scan(&leStr); err != nil { ... }
if !leStr.Valid { continue }
Defensive patterns

Strategy: fallback

Try / catch

// Treat unscannable le rows as skip-worthy, not fatal
var leStr sql.NullString
if err := rows.Scan(&leStr); err != nil {
    r.logger.Error("skipping bad le row", errorsV2.Attr(err))
    continue
}

Prevention

When it happens

Trigger: Histogram bucket query returns rows where le is NULL or a non-string type; schema drift in time_series_exp_histogram where le is materialized differently than the reader expects.

Common situations: SigNoz upgrade changed the le column type in the v4 histogram table; OTEL exporters emitting explicit-bucket histograms with missing/NULL le values; mixed old/new data after migration.

Related errors


AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28). Data as JSON: /api/errors/516299f4c0d33ac5. Report an issue: GitHub.