{"record":{"id":"aef966894e5f8125","repo":"SigNoz/signoz","slug":"error-while-scanning-meter-name-s","errorCode":null,"errorMessage":"error while scanning meter name: %s","messagePattern":"error while scanning meter name: (.+?)","errorType":"exception","errorClass":null,"httpStatus":500,"severity":"error","filePath":"pkg/query-service/app/clickhouseReader/reader.go","lineNumber":3075,"sourceCode":"\n\tif req.Limit != 0 {\n\t\tquery = query + fmt.Sprintf(\" LIMIT %d;\", req.Limit)\n\t}\n\n\trows, err := r.db.Query(ctx, query, fmt.Sprintf(\"%%%s%%\", req.SearchText))\n\tif err != nil {\n\t\tr.logger.Error(\"Error while querying meter names\", errorsV2.Attr(err))\n\t\treturn nil, fmt.Errorf(\"error while executing meter name query: %s\", err.Error())\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar name string\n\t\tvar typ string\n\t\tvar temporality string\n\t\tvar isMonotonic bool\n\t\tif err := rows.Scan(&name, &typ, &temporality, &isMonotonic); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error while scanning meter name: %s\", err.Error())\n\t\t}\n\n\t\t// Non-monotonic cumulative sums are treated as gauges\n\t\tif typ == \"Sum\" && !isMonotonic && temporality == string(v3.Cumulative) {\n\t\t\ttyp = \"Gauge\"\n\t\t}\n\n\t\t// unlike traces/logs `tag`/`resource` type, the `Type` will be metric type\n\t\tkey := v3.AttributeKey{\n\t\t\tKey:      name,\n\t\t\tDataType: v3.AttributeKeyDataTypeFloat64,\n\t\t\tType:     v3.AttributeKeyType(typ),\n\t\t\tIsColumn: true,\n\t\t}\n\t\tresponse.AttributeKeys = append(response.AttributeKeys, key)\n\t}\n\n\treturn &response, nil","sourceCodeStart":3057,"sourceCodeEnd":3093,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/app/clickhouseReader/reader.go#L3057-L3093","documentation":"Scanning a row of the meter-name query failed: the query returns four columns (name, typ, temporality, isMonotonic) and rows.Scan into (&name, &typ, &temporality, &isMonotonic) did not match the actual row shape — wrong column count or incompatible types.","triggerScenarios":"The underlying table/view returns a different number of columns (schema drift), or one of the columns is Nullable / a non-bool type (e.g. UInt8 vs bool) that the driver refuses to scan into the declared Go types.","commonSituations":"Upgrading ClickHouse schema without upgrading query-service (or vice versa); driver version change altering type mappings; empty meter rows with NULL temporality.","solutions":["Run the meter query manually and compare column count/types against the four scan targets","Align SigNoz query-service and ClickHouse schema versions","Scan risky columns into sql.Null* types to tolerate NULLs","Pin a known-good clickhouse-go driver version if a dependency bump triggered it"],"exampleFix":"// before\nvar isMonotonic bool\nif err := rows.Scan(&name, &typ, &temporality, &isMonotonic); err != nil { ... }\n\n// after\nvar isMonotonic sql.NullBool\nif err := rows.Scan(&name, &typ, &temporality, &isMonotonic); err != nil { ... }\nif !isMonotonic.Valid { isMonotonic.Bool = false }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"for rows.Next() {\n  var name, typ, temporality sql.NullString\n  var isMonotonic sql.NullBool\n  if err := rows.Scan(&name, &typ, &temporality, &isMonotonic); err != nil {\n    logger.Warn(\"skipping meter row\", errorsV2.Attr(err)); continue\n  }\n  ...\n}","preventionTips":["Tolerate NULL columns with sql.Null* scan targets","Align schema and query-service versions on every upgrade","Pin the clickhouse-go driver version that matches your schema"],"tags":["clickhouse","metrics","meters","row-scan","schema-drift"],"backgroundTag":"row-scan-type-mismatch","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}