googleapis/mcp-toolbox · error
unable to retrieve rows column name: %w
Error message
unable to retrieve rows column name: %w
What it means
After executing the query, RunSQL calls results.Columns() to obtain column names. Failure here (wrapped as this error) means the result set metadata could not be retrieved from the driver.
Source
Thrown at internal/sources/clickhouse/clickhouse.go:121
func (s *Source) ClickHousePool() *sql.DB {
return s.Pool
}
func (s *Source) RunSQL(ctx context.Context, statement string, params parameters.ParamValues) (any, error) {
var sliceParams []any
if params != nil {
sliceParams = params.AsSlice()
}
results, err := s.ClickHousePool().QueryContext(ctx, statement, sliceParams...)
if err != nil {
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 {View on GitHub (pinned to 8cc6e09de2)
Solutions
- Check the wrapped error for connection-level failures.
- Verify network stability between toolbox and ClickHouse.
- Retry the query; this is usually transient infrastructure-level.
- Ensure no concurrent Close on the results.
Defensive patterns
Strategy: retry
Try / catch
rows, err := src.RunSQL(ctx, stmt)
if err != nil {
if strings.Contains(err.Error(), "unable to retrieve rows column name") {
return retryWithBackoff(ctx, stmt) // transient stream failure
}
return err
} Prevention
- Avoid concurrent use of the same connection.
- Keep result sets within memory/time limits.
- Monitor network stability to ClickHouse.
When it happens
Trigger: Calling results.Columns() on a rows object in an invalid state — typically after the connection or result stream broke.
Common situations: Connection dropped between query execution and metadata read, driver returned closed/invalid rows.
Related errors
- unable to execute query: %w
- unable to get column types: %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/947bfe01639e69bb.
Report an issue: GitHub.