googleapis/mcp-toolbox · error

unable to retrieve rows column name: %w

Error message

unable to retrieve rows column name: %w

What it means

After a successful query, RunSQL calls results.Columns() to read the result set's column names; failure to access result-set metadata is wrapped as "unable to retrieve rows column name". This is rare and usually indicates a broken or already-closed connection/result object rather than a problem with the SQL itself.

Source

Thrown at internal/sources/mindsdb/mindsdb.go:119

func (s *Source) MindsDBPool() *sql.DB {
	return s.Pool
}

func (s *Source) MySQLPool() *sql.DB {
	return s.Pool
}

func (s *Source) RunSQL(ctx context.Context, statement string, params []any) (any, error) {
	// MindsDB now supports MySQL prepared statements natively
	results, err := s.MindsDBPool().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. Retry the query — transient connection drops resolve on re-execute
  2. Check MindsDB server logs for restarts or aborted connections
  3. Ensure no intermediate proxy terminates idle MySQL connections; enable keepalives
  4. Verify driver and server protocol versions are compatible
Defensive patterns

Strategy: retry

Try / catch

cols, err := results.Columns()
if err != nil {
    // transient: close and retry the query once with backoff
    results.Close()
    return retryQuery(ctx, statement, params)
}

Prevention

When it happens

Trigger: results.Columns() returns an error — typically when the underlying MySQL connection was dropped between execution and metadata read, or the driver returned a corrupt/aborted result set.

Common situations: MindsDB server restarting mid-query; connection killed by proxy/load-balancer idle timeout; driver bug or protocol desync after a large result set.

Related errors


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