{"record":{"id":"bec625eb9ef999b8","repo":"SigNoz/signoz","slug":"couldn-t-scan-attrib-value-rows-w","errorCode":null,"errorMessage":"couldn't scan attrib value rows: %w","messagePattern":"couldn't scan attrib value rows: %w","errorType":"exception","errorClass":"model.ApiError","httpStatus":500,"severity":"error","filePath":"pkg/query-service/app/clickhouseReader/filter_suggestions.go","lineNumber":213,"sourceCode":"\n\t// Helper for getting hold of the result slice to append to for each scanned row\n\tresultIdxForAttrib := func(key string, dataType v3.AttributeKeyDataType) int {\n\t\treturn slices.IndexFunc(attributes, func(attrib v3.AttributeKey) bool {\n\t\t\treturn attrib.Key == key && attrib.DataType == dataType\n\t\t})\n\t}\n\n\t// Scan rows and append to result\n\tfor rows.Next() {\n\t\tvar tagKey string\n\t\tvar stringValue string\n\t\tvar float64Value sql.NullFloat64\n\n\t\terr := rows.Scan(\n\t\t\t&tagKey, &stringValue, &float64Value,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn nil, model.InternalError(fmt.Errorf(\n\t\t\t\t\"couldn't scan attrib value rows: %w\", err,\n\t\t\t))\n\t\t}\n\n\t\tif len(stringValue) > 0 {\n\t\t\tattrResultIdx := resultIdxForAttrib(tagKey, v3.AttributeKeyDataTypeString)\n\t\t\tif attrResultIdx >= 0 {\n\t\t\t\tresult[attrResultIdx] = append(result[attrResultIdx], stringValue)\n\t\t\t}\n\n\t\t} else if float64Value.Valid {\n\t\t\tattrResultIdx := resultIdxForAttrib(tagKey, v3.AttributeKeyDataTypeFloat64)\n\t\t\tif attrResultIdx >= 0 {\n\t\t\t\tresult[attrResultIdx] = append(result[attrResultIdx], float64Value.Float64)\n\t\t\t}\n\t\t}\n\t}\n","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/app/clickhouseReader/filter_suggestions.go#L195-L231","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the wrapped scan error for the offending column/type","Run DESCRIBE on the tag value tables and compare with expected schema; re-run migrations","Align ClickHouse server and clickhouse-go driver versions","As a workaround, remove the problematic attribute from the suggestion request"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Ensure schema types match scan expectations before querying\nfor _, c := range describeTable(ctx, ch, \"signoz_logs\", tagValuesTable) {\n    if c.Name == \"tagKey\" && c.Type != \"String\" { return fmt.Errorf(\"schema drift on tagKey\") }\n}","typeGuard":"func isScanErr(err error) bool {\n    var apiErr *model.ApiError\n    return errors.As(err, &apiErr) && strings.Contains(err.Error(), \"scan attrib value rows\")\n}","tryCatchPattern":"if _, err := reader.GetQBFilterSuggestionsForLogs(ctx, req); err != nil {\n    if isScanErr(err) {\n        // drop suspect attributes and retry with a reduced set\n        req.AttributeKeys = filterKnownGood(req.AttributeKeys)\n    }\n}","preventionTips":["Pin matching clickhouse-go and server versions","Run schema migrations atomically during upgrades","Alert on any Scan-type errors as early schema-drift signals"],"tags":["clickhouse","row-scan","logs","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"}