SigNoz/signoz · error
unsupported value type encountered
Error message
unsupported value type encountered
What it means
In the code that converts a stored ClickHouse row into metric/variable metadata, each value in vars must be a pointer to one of a fixed set of scalar types (string, ints, uints, floats, time.Time, bool). If any value has any other Go type, the switch's default branch fires and returns this plain error, aborting the whole conversion.
Source
Thrown at pkg/query-service/app/clickhouseReader/reader.go:2943
var (
columnTypes = rows.ColumnTypes()
vars = make([]interface{}, len(columnTypes))
)
for i := range columnTypes {
vars[i] = reflect.New(columnTypes[i].ScanType()).Interface()
}
defer rows.Close()
for rows.Next() {
if err := rows.Scan(vars...); err != nil {
return nil, err
}
for _, v := range vars {
switch v := v.(type) {
case *string, *int8, *int16, *int32, *int64, *uint8, *uint16, *uint32, *uint64, *float32, *float64, *time.Time, *bool:
result.VariableValues = append(result.VariableValues, reflect.ValueOf(v).Elem().Interface())
default:
return nil, fmt.Errorf("unsupported value type encountered")
}
}
}
return &result, nil
}
func (r *ClickHouseReader) GetMetricAggregateAttributes(ctx context.Context, orgID valuer.UUID, req *v3.AggregateAttributeRequest, skipSignozMetrics bool) (*v3.AggregateAttributeResponse, error) {
ctx = ctxtypes.NewContextWithCommentVals(ctx, map[string]string{
instrumentationtypes.TelemetrySignal: telemetrytypes.SignalMetrics.StringValue(),
instrumentationtypes.CodeNamespace: "clickhouse-reader",
instrumentationtypes.CodeFunctionName: "GetMetricAggregateAttributes",
})
var response v3.AggregateAttributeResponse
reductionEnabled := r.fl.BooleanOrEmpty(ctx, flagger.FeatureEnableMetricsReduction, featuretypes.NewFlaggerEvaluationContext(orgID))
// Query all relevant metric names from time_series_v4, but leave metadata retrieval to cache/db.
var query stringView on GitHub (pinned to 5069bf80b0)
Solutions
- Identify which var has the unsupported type (log %T for each element of vars before the switch)
- Add the missing case (e.g. case *[]string:) or convert the field to a supported scalar type
- If the column is Nullable, scan into sql.NullString-style types or ensure the driver maps it to *T
- Add a unit test enumerating every field type the struct can carry so regressions are caught at build time
Example fix
// before
switch v := v.(type) {
case *string, *int64: ...
default:
return nil, fmt.Errorf("unsupported value type encountered")
}
// after - add the new field's type
switch v := v.(type) {
case *string, *int64, *[]string:
result.VariableValues = append(result.VariableValues, reflect.ValueOf(v).Elem().Interface())
default:
return nil, fmt.Errorf("unsupported value type encountered: %T", v)
} Defensive patterns
Strategy: type-guard
Type guard
func isSupportedVarType(v interface{}) bool {
switch v.(type) {
case *string, *int8, *int16, *int32, *int64, *uint8, *uint16, *uint32, *uint64, *float32, *float64, *time.Time, *bool:
return true
}
return false
} Try / catch
// plain error return — handle as internal 500 with the offending type logged (%T)
Prevention
- Extend the type switch whenever adding fields to the scanned struct
- Unit-test the conversion for every field type in the struct
- Log %T of unknown values to make future occurrences debuggable
When it happens
Trigger: A query's destination struct was extended with a new field type (e.g. *[]string, *map[string]string, *json.RawMessage, *uuid.UUID) that is scanned into vars and passed to this switch; the scan succeeds but the type switch rejects it.
Common situations: Adding a column/field to a metrics metadata struct without updating this type switch; ClickHouse driver returning an unexpected concrete type after a driver version bump; Nullable columns scanned as **T instead of *T.
Related errors
- CodeInternal
- group by requires aggregate operator other than noop or rate
- invalid data type, expected int, got %v
- CodeLicenseUnavailable
- CodeInvalidInput
AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28).
Data as JSON: /api/errors/ccf1c5e329f30e49.
Report an issue: GitHub.