SigNoz/signoz · error · model.ApiError

couldn't scan attrib value rows: %w

Error message

couldn't scan attrib value rows: %w

What it means

InternalError returned while iterating rows.Scan in getValuesForLogAttributes: a row returned by ClickHouse could not be scanned into the expected (tagKey string, stringValue, float64Value) triple, e.g. unexpected type or NULL in a non-nullable position.

Source

Thrown at pkg/query-service/app/clickhouseReader/filter_suggestions.go:213

	// Helper for getting hold of the result slice to append to for each scanned row
	resultIdxForAttrib := func(key string, dataType v3.AttributeKeyDataType) int {
		return slices.IndexFunc(attributes, func(attrib v3.AttributeKey) bool {
			return attrib.Key == key && attrib.DataType == dataType
		})
	}

	// Scan rows and append to result
	for rows.Next() {
		var tagKey string
		var stringValue string
		var float64Value sql.NullFloat64

		err := rows.Scan(
			&tagKey, &stringValue, &float64Value,
		)
		if err != nil {
			return nil, model.InternalError(fmt.Errorf(
				"couldn't scan attrib value rows: %w", err,
			))
		}

		if len(stringValue) > 0 {
			attrResultIdx := resultIdxForAttrib(tagKey, v3.AttributeKeyDataTypeString)
			if attrResultIdx >= 0 {
				result[attrResultIdx] = append(result[attrResultIdx], stringValue)
			}

		} else if float64Value.Valid {
			attrResultIdx := resultIdxForAttrib(tagKey, v3.AttributeKeyDataTypeFloat64)
			if attrResultIdx >= 0 {
				result[attrResultIdx] = append(result[attrResultIdx], float64Value.Float64)
			}
		}
	}

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Inspect the wrapped scan error for the offending column/type
  2. Run DESCRIBE on the tag value tables and compare with expected schema; re-run migrations
  3. Align ClickHouse server and clickhouse-go driver versions
  4. As a workaround, remove the problematic attribute from the suggestion request
Defensive patterns

Strategy: validation

Validate before calling

// Ensure schema types match scan expectations before querying
for _, c := range describeTable(ctx, ch, "signoz_logs", tagValuesTable) {
    if c.Name == "tagKey" && c.Type != "String" { return fmt.Errorf("schema drift on tagKey") }
}

Type guard

func isScanErr(err error) bool {
    var apiErr *model.ApiError
    return errors.As(err, &apiErr) && strings.Contains(err.Error(), "scan attrib value rows")
}

Try / catch

if _, err := reader.GetQBFilterSuggestionsForLogs(ctx, req); err != nil {
    if isScanErr(err) {
        // drop suspect attributes and retry with a reduced set
        req.AttributeKeys = filterKnownGood(req.AttributeKeys)
    }
}

Prevention

When it happens

Trigger: ClickHouse returns rows whose column types don't match the scan targets — schema drift (a column changed type after upgrade), NULLs in tagKey, or driver-level deserialization mismatches during the suggestions query.

Common situations: Upgrading SigNoz/ClickHouse where log attribute table column types changed, mixed old/new nodes in a CH cluster returning heterogeneous data, or driver version incompatibility.

Related errors


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