googleapis/mcp-toolbox · error

unable to retrieve rows column name: %w

Error message

unable to retrieve rows column name: %w

What it means

results.Columns() failed to enumerate column names for the executed query in RunSQL — the driver could not produce metadata, usually because the statement handle or connection became invalid.

Source

Thrown at internal/sources/tidb/tidb.go:121

}

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

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

func (s *Source) RunSQL(ctx context.Context, statement string, params []any) (any, error) {
	results, err := s.TiDBPool().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 on transient driver failures
  2. Ensure the statement returns a result set
  3. Inspect the wrapped MySQL driver error
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at internal/sources/tidb/tidb.go:121 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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