{"record":{"id":"af884e83da5ac8de","repo":"googleapis/mcp-toolbox","slug":"unable-to-get-column-types-w","errorCode":null,"errorMessage":"unable to get column types: %w","messagePattern":"unable to get column types: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/clickhouse/clickhouse.go","lineNumber":133,"sourceCode":"\t\treturn nil, fmt.Errorf(\"unable to execute query: %w\", err)\n\t}\n\tdefer results.Close()\n\n\tcols, err := results.Columns()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to retrieve rows column name: %w\", err)\n\t}\n\n\t// create an array of values for each column, which can be re-used to scan each row\n\trawValues := make([]any, len(cols))\n\tvalues := make([]any, len(cols))\n\tfor i := range rawValues {\n\t\tvalues[i] = &rawValues[i]\n\t}\n\n\tcolTypes, err := results.ColumnTypes()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to get column types: %w\", err)\n\t}\n\n\tout := []any{}\n\tfor results.Next() {\n\t\terr := results.Scan(values...)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to parse row: %w\", err)\n\t\t}\n\t\tvMap := make(map[string]any)\n\t\tfor i, name := range cols {\n\t\t\t// ClickHouse driver may return specific types that need handling\n\t\t\tswitch colTypes[i].DatabaseTypeName() {\n\t\t\tcase \"String\", \"FixedString\":\n\t\t\t\tif rawValues[i] != nil {\n\t\t\t\t\t// Handle potential []byte to string conversion if needed\n\t\t\t\t\tif b, ok := rawValues[i].([]byte); ok {\n\t\t\t\t\t\tvMap[name] = string(b)\n\t\t\t\t\t} else {","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/clickhouse/clickhouse.go#L115-L151","documentation":"RunSQL calls results.ColumnTypes() to map ClickHouse-specific types (e.g. String/FixedString) for value handling. If the driver cannot return column types, this error wraps the cause.","triggerScenarios":"Calling results.ColumnTypes() fails after a successful Columns() call — usually due to a broken result stream or driver state error.","commonSituations":"Connection failure mid-query, driver/driver-version incompatibility, results closed prematurely.","solutions":["Read the wrapped error for the driver's root cause.","Check connection stability and retry the query.","Verify the clickhouse-go driver version is compatible with the server.","Ensure nothing concurrently closes the results."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"rows, err := src.RunSQL(ctx, stmt)\nif err != nil {\n    if strings.Contains(err.Error(), \"unable to get column types\") {\n        return retryWithBackoff(ctx, stmt)\n    }\n    return err\n}","preventionTips":["Pin a compatible clickhouse-go driver version.","Avoid closing results concurrently.","Retry transient stream failures."],"tags":["clickhouse","query","column-types"],"backgroundTag":"result-metadata-unavailable","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}