SigNoz/signoz · error · model.InternalError
couldn't scan metric status row: %w
Error message
couldn't scan metric status row: %w
What it means
Internal error from scanning a row of the metric-status query into (metric name, labels JSON, last-received timestamp millis). Indicates the result columns don't match the expected three-column shape/types, or a NULL in a non-nullable target.
Source
Thrown at pkg/query-service/app/clickhouseReader/reader.go:3423
"couldn't query clickhouse for received metrics status: %w", err,
))
}
defer rows.Close()
var result *model.MetricStatus
if rows.Next() {
result = &model.MetricStatus{}
var labelsJson string
err := rows.Scan(
&result.MetricName,
&labelsJson,
&result.LastReceivedTsMillis,
)
if err != nil {
return nil, model.InternalError(fmt.Errorf(
"couldn't scan metric status row: %w", err,
))
}
err = json.Unmarshal([]byte(labelsJson), &result.LastReceivedLabels)
if err != nil {
return nil, model.InternalError(fmt.Errorf(
"couldn't unmarshal metric labels json: %w", err,
))
}
}
return result, nil
}
func isColumn(tableStatement, attrType, field, datType string) bool {
name := fmt.Sprintf("`%s`", utils.GetClickhouseColumnNameV2(attrType, datType, field))
return strings.Contains(tableStatement, fmt.Sprintf("%s ", name))View on GitHub (pinned to 5069bf80b0)
Solutions
- Inspect the wrapped scan error for which column mismatched
- Run the status query manually and check for NULLs in the three selected columns
- Scan into sql.Null* types where NULLs are possible
- Re-run migrations to align schema
Example fix
// before
&result.LastReceivedTsMillis,
// after (if ts can be NULL)
var ts sql.NullInt64
... scan &ts ...
if ts.Valid { result.LastReceivedTsMillis = ts.Int64 } Defensive patterns
Strategy: fallback
Try / catch
if err := rows.Scan(&name, &labels, &ts); err != nil {
// log and skip this row instead of failing the whole request
continue
} Prevention
- Prefer sql.Null* scans for nullable columns
- Keep single ingester version writing time_series metadata
When it happens
Trigger: time_series table returns rows where last_received_ts or labels JSON is NULL, or column order/type changed between SigNoz versions.
Common situations: Schema drift after upgrade; rows written by an older ingester lacking label JSON; partial writes during ingestion incidents.
Related errors
AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28).
Data as JSON: /api/errors/efa56cb49d569fb3.
Report an issue: GitHub.