SigNoz/signoz · error

error while scanning meter name: %s

Error message

error while scanning meter name: %s

What it means

Scanning a row of the meter-name query failed: the query returns four columns (name, typ, temporality, isMonotonic) and rows.Scan into (&name, &typ, &temporality, &isMonotonic) did not match the actual row shape — wrong column count or incompatible types.

Source

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

	if req.Limit != 0 {
		query = query + fmt.Sprintf(" LIMIT %d;", req.Limit)
	}

	rows, err := r.db.Query(ctx, query, fmt.Sprintf("%%%s%%", req.SearchText))
	if err != nil {
		r.logger.Error("Error while querying meter names", errorsV2.Attr(err))
		return nil, fmt.Errorf("error while executing meter name query: %s", err.Error())
	}
	defer rows.Close()

	for rows.Next() {
		var name string
		var typ string
		var temporality string
		var isMonotonic bool
		if err := rows.Scan(&name, &typ, &temporality, &isMonotonic); err != nil {
			return nil, fmt.Errorf("error while scanning meter name: %s", err.Error())
		}

		// Non-monotonic cumulative sums are treated as gauges
		if typ == "Sum" && !isMonotonic && temporality == string(v3.Cumulative) {
			typ = "Gauge"
		}

		// unlike traces/logs `tag`/`resource` type, the `Type` will be metric type
		key := v3.AttributeKey{
			Key:      name,
			DataType: v3.AttributeKeyDataTypeFloat64,
			Type:     v3.AttributeKeyType(typ),
			IsColumn: true,
		}
		response.AttributeKeys = append(response.AttributeKeys, key)
	}

	return &response, nil

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Run the meter query manually and compare column count/types against the four scan targets
  2. Align SigNoz query-service and ClickHouse schema versions
  3. Scan risky columns into sql.Null* types to tolerate NULLs
  4. Pin a known-good clickhouse-go driver version if a dependency bump triggered it

Example fix

// before
var isMonotonic bool
if err := rows.Scan(&name, &typ, &temporality, &isMonotonic); err != nil { ... }

// after
var isMonotonic sql.NullBool
if err := rows.Scan(&name, &typ, &temporality, &isMonotonic); err != nil { ... }
if !isMonotonic.Valid { isMonotonic.Bool = false }
Defensive patterns

Strategy: try-catch

Try / catch

for rows.Next() {
  var name, typ, temporality sql.NullString
  var isMonotonic sql.NullBool
  if err := rows.Scan(&name, &typ, &temporality, &isMonotonic); err != nil {
    logger.Warn("skipping meter row", errorsV2.Attr(err)); continue
  }
  ...
}

Prevention

When it happens

Trigger: The underlying table/view returns a different number of columns (schema drift), or one of the columns is Nullable / a non-bool type (e.g. UInt8 vs bool) that the driver refuses to scan into the declared Go types.

Common situations: Upgrading ClickHouse schema without upgrading query-service (or vice versa); driver version change altering type mappings; empty meter rows with NULL temporality.

Related errors


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