googleapis/mcp-toolbox · error

unable to retrieve rows column name: %w

Error message

unable to retrieve rows column name: %w

What it means

RunSQL wraps results.Columns() errors with this message. Columns() inspects the result set metadata returned by the server; failure means the driver cannot obtain column names for the result set, typically because the connection or result set became invalid right after execution.

Source

Thrown at internal/sources/singlestore/singlestore.go:123

func (s *Source) ToConfig() sources.SourceConfig {
	return s.Config
}

// SingleStorePool returns the underlying *sql.DB connection pool for SingleStore.
func (s *Source) SingleStorePool() *sql.DB {
	return s.Pool
}

func (s *Source) RunSQL(ctx context.Context, statement string, params []any) (any, error) {
	results, err := s.SingleStorePool().QueryContext(ctx, statement, params...)
	if err != nil {
		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...)

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Read the wrapped driver error to confirm whether it is a network/connection issue.
  2. Retry the query; transient connection drops usually succeed on retry.
  3. Increase readTimeout (via queryTimeout config) so slow result metadata does not hit the deadline.
  4. Check server logs for connection kills or proxy/firewall idle timeouts.
  5. Verify SingleStore cluster health and upgrade the go-sql-driver/mysql dependency if the error persists.
Defensive patterns

Strategy: retry

Try / catch

out, err := source.RunSQL(ctx, stmt, params)
if err != nil && strings.Contains(err.Error(), "unable to retrieve rows column name") {
    time.Sleep(500 * time.Millisecond)
    out, err = source.RunSQL(ctx, stmt, params) // single retry for transient drops
}
if err != nil { return err }

Prevention

When it happens

Trigger: QueryContext succeeded but the underlying connection dropped or the result set was invalidated before column metadata could be read.

Common situations: Network interruption mid-query, server-side connection kill, very short readTimeout causing the connection to be reaped between query and metadata read.

Related errors


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/e72832a95cff7516. Report an issue: GitHub.