{"record":{"id":"ccf1c5e329f30e49","repo":"SigNoz/signoz","slug":"unsupported-value-type-encountered","errorCode":null,"errorMessage":"unsupported value type encountered","messagePattern":"unsupported value type encountered","errorType":"exception","errorClass":null,"httpStatus":500,"severity":"error","filePath":"pkg/query-service/app/clickhouseReader/reader.go","lineNumber":2943,"sourceCode":"\tvar (\n\t\tcolumnTypes = rows.ColumnTypes()\n\t\tvars        = make([]interface{}, len(columnTypes))\n\t)\n\tfor i := range columnTypes {\n\t\tvars[i] = reflect.New(columnTypes[i].ScanType()).Interface()\n\t}\n\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tif err := rows.Scan(vars...); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, v := range vars {\n\t\t\tswitch v := v.(type) {\n\t\t\tcase *string, *int8, *int16, *int32, *int64, *uint8, *uint16, *uint32, *uint64, *float32, *float64, *time.Time, *bool:\n\t\t\t\tresult.VariableValues = append(result.VariableValues, reflect.ValueOf(v).Elem().Interface())\n\t\t\tdefault:\n\t\t\t\treturn nil, fmt.Errorf(\"unsupported value type encountered\")\n\t\t\t}\n\t\t}\n\t}\n\treturn &result, nil\n}\n\nfunc (r *ClickHouseReader) GetMetricAggregateAttributes(ctx context.Context, orgID valuer.UUID, req *v3.AggregateAttributeRequest, skipSignozMetrics bool) (*v3.AggregateAttributeResponse, error) {\n\tctx = ctxtypes.NewContextWithCommentVals(ctx, map[string]string{\n\t\tinstrumentationtypes.TelemetrySignal:  telemetrytypes.SignalMetrics.StringValue(),\n\t\tinstrumentationtypes.CodeNamespace:    \"clickhouse-reader\",\n\t\tinstrumentationtypes.CodeFunctionName: \"GetMetricAggregateAttributes\",\n\t})\n\tvar response v3.AggregateAttributeResponse\n\n\treductionEnabled := r.fl.BooleanOrEmpty(ctx, flagger.FeatureEnableMetricsReduction, featuretypes.NewFlaggerEvaluationContext(orgID))\n\n\t// Query all relevant metric names from time_series_v4, but leave metadata retrieval to cache/db.\n\tvar query string","sourceCodeStart":2925,"sourceCodeEnd":2961,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/app/clickhouseReader/reader.go#L2925-L2961","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nswitch v := v.(type) {\ncase *string, *int64: ...\ndefault:\n  return nil, fmt.Errorf(\"unsupported value type encountered\")\n}\n\n// after - add the new field's type\nswitch v := v.(type) {\ncase *string, *int64, *[]string:\n  result.VariableValues = append(result.VariableValues, reflect.ValueOf(v).Elem().Interface())\ndefault:\n  return nil, fmt.Errorf(\"unsupported value type encountered: %T\", v)\n}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"func isSupportedVarType(v interface{}) bool {\n  switch v.(type) {\n  case *string, *int8, *int16, *int32, *int64, *uint8, *uint16, *uint32, *uint64, *float32, *float64, *time.Time, *bool:\n    return true\n  }\n  return false\n}","tryCatchPattern":"// plain error return — handle as internal 500 with the offending type logged (%T)","preventionTips":["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"],"tags":["go","type-mismatch","type-switch","metrics","internal-error"],"backgroundTag":"unsupported-type-conversion","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}