googleapis/mcp-toolbox · error
unable to get column types: %w
Error message
unable to get column types: %w
What it means
RunSQL wraps results.ColumnTypes() errors with this message. ColumnTypes() fetches per-column type information needed to convert raw driver values into Go types (via ConvertToType); failure indicates the result set metadata could not be fully retrieved from the driver.
Source
Thrown at internal/sources/singlestore/singlestore.go:136
return nil, fmt.Errorf("unable to execute query: %w", err)
}
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]
}
defer results.Close()
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 {
val := rawValues[i]
if val == nil {
vMap[name] = nil
continue
}
vMap[name], err = mysqlcommon.ConvertToType(colTypes[i], val)
if err != nil {View on GitHub (pinned to 8cc6e09de2)
Solutions
- Inspect the wrapped driver error for the precise protocol/network cause.
- Retry the query to rule out a transient connection drop.
- Check network path (load balancers, proxies) for idle/short timeouts and raise them.
- Confirm the SingleStore server version is supported by the MySQL driver in use.
- If reproducible for a specific statement, simplify the query's column expressions to isolate the offending type.
Defensive patterns
Strategy: retry
Try / catch
out, err := source.RunSQL(ctx, stmt, params)
if err != nil && strings.Contains(err.Error(), "unable to get column types") {
// log and retry once; fall back to a simpler SELECT if persistent
out, err = source.RunSQL(ctx, simplifiedStmt, params)
}
if err != nil { return err } Prevention
- Avoid exotic column types in result sets; CAST when needed
- Keep the MySQL driver and toolbox up to date
- Verify server version compatibility
- Check network intermediaries for truncation
When it happens
Trigger: After Columns() succeeds, results.ColumnTypes() returns an error — usually the same class of connection/protocol failure as Columns(), e.g. the connection died while fetching extended column type metadata.
Common situations: Mid-query network failure, server closed the connection, driver/protocol mismatch with an unusual column type, or a proxy truncating the response.
Related errors
- unable to retrieve rows column name: %w
- unable to parse row: %w
- errors encountered when converting values: %w
- unable to execute query: %w
- errors encountered during row iteration: %w
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/4555278206b9a18e.
Report an issue: GitHub.