SigNoz/signoz · error
error while scanning metric name: %s
Error message
error while scanning metric name: %s
What it means
While iterating the result rows of the metric-name query, rows.Scan(&name) failed for at least one row. This happens when the result set's column layout does not match the single string destination — usually a schema change in the underlying view/table or a driver deserialization problem for the metric name column.
Source
Thrown at pkg/query-service/app/clickhouseReader/reader.go:2994
signozMetricDBName, signozTSTableNameV41Day)
}
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 metric names", errorsV2.Attr(err))
return nil, fmt.Errorf("error while executing metric name query: %s", err.Error())
}
defer rows.Close()
var metricNames []string
for rows.Next() {
var name string
if err := rows.Scan(&name); err != nil {
return nil, fmt.Errorf("error while scanning metric name: %s", err.Error())
}
if skipSignozMetrics && strings.HasPrefix(name, "signoz") {
continue
}
metricNames = append(metricNames, name)
}
if len(metricNames) == 0 {
return &response, nil
}
// Get all metadata in one shot
metadataMap, apiError := r.GetUpdatedMetricsMetadata(ctx, orgID, metricNames...)
if apiError != nil {
return &response, fmt.Errorf("error getting updated metrics metadata: %s", apiError.Error())
}
seen := make(map[string]struct{})View on GitHub (pinned to 5069bf80b0)
Solutions
- Run the logged query manually in ClickHouse and inspect the result column types
- Align query-service version with the schema (upgrade both or roll both back)
- Scan into a []string-compatible type like sql.NullString if nulls appear
- Check clickhouse-go driver version compatibility if errors started after a dependency bump
Example fix
// before
var name string
if err := rows.Scan(&name); err != nil { ... }
// after
var name sql.NullString
if err := rows.Scan(&name); err != nil { ... }
if !name.Valid { continue } Defensive patterns
Strategy: try-catch
Try / catch
// log and skip bad rows rather than aborting the whole listing
for rows.Next() {
var name sql.NullString
if err := rows.Scan(&name); err != nil {
logger.Warn("skipping unscannable metric row", errorsV2.Attr(err))
continue
}
if name.Valid { metricNames = append(metricNames, name.String) }
} Prevention
- Use sql.NullString for columns that may be NULL
- Pin compatible driver and schema versions
- Integration-test listings against the real schema
When it happens
Trigger: The metric names query returns columns that aren't a single string (e.g. after a table/view redefinition or a UNION with mismatched types), or the name column becomes Nullable(String)/LowCardinality the driver can't scan into plain string on some rows.
Common situations: Schema drift between query-service version and ClickHouse tables; partial upgrades; a view over time_series changed shape; driver version incompatibility.
Related errors
- error while scanning meter name: %s
- couldn't scan attrib value rows: %w
- error in reading data
- error while scanning rows: %s
- CodeLicenseUnavailable
AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28).
Data as JSON: /api/errors/c02f20bcfbeb9df5.
Report an issue: GitHub.