googleapis/mcp-toolbox · error
unable to get column types: %w
Error message
unable to get column types: %w
What it means
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.
Source
Thrown at internal/sources/clickhouse/clickhouse.go:133
return nil, fmt.Errorf("unable to execute query: %w", err)
}
defer results.Close()
cols, err := results.Columns()
if err != nil {
return nil, fmt.Errorf("unable to retrieve rows column name: %w", err)
}
// create an array of values for each column, which can be re-used to scan each row
rawValues := make([]any, len(cols))
values := make([]any, len(cols))
for i := range rawValues {
values[i] = &rawValues[i]
}
colTypes, err := results.ColumnTypes()
if err != nil {
return nil, fmt.Errorf("unable to get column types: %w", err)
}
out := []any{}
for results.Next() {
err := results.Scan(values...)
if err != nil {
return nil, fmt.Errorf("unable to parse row: %w", err)
}
vMap := make(map[string]any)
for i, name := range cols {
// ClickHouse driver may return specific types that need handling
switch colTypes[i].DatabaseTypeName() {
case "String", "FixedString":
if rawValues[i] != nil {
// Handle potential []byte to string conversion if needed
if b, ok := rawValues[i].([]byte); ok {
vMap[name] = string(b)
} else {View on GitHub (pinned to 8cc6e09de2)
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.
Defensive patterns
Strategy: retry
Try / catch
rows, err := src.RunSQL(ctx, stmt)
if err != nil {
if strings.Contains(err.Error(), "unable to get column types") {
return retryWithBackoff(ctx, stmt)
}
return err
} Prevention
- Pin a compatible clickhouse-go driver version.
- Avoid closing results concurrently.
- Retry transient stream failures.
When it happens
Trigger: Calling results.ColumnTypes() fails after a successful Columns() call — usually due to a broken result stream or driver state error.
Common situations: Connection failure mid-query, driver/driver-version incompatibility, results closed prematurely.
Related errors
- unable to execute query: %w
- unable to retrieve rows column name: %w
- unable to parse rows: %w
- unable to create pool: %w
- unable to connect successfully: %w
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/af884e83da5ac8de.
Report an issue: GitHub.