googleapis/mcp-toolbox · error

unable to get columns: %w

Error message

unable to get columns: %w

What it means

rows.Columns() failed on an already-open result set in RunSQL — the driver could not enumerate column metadata, usually because the connection or statement handle became invalid mid-iteration.

Source

Thrown at internal/sources/snowflake/snowflake.go:116

	return s.Config
}

func (s *Source) SnowflakeDB() *sqlx.DB {
	return s.DB
}

func (s *Source) RunSQL(ctx context.Context, statement string, params []any) (any, error) {
	rows, err := s.DB.QueryxContext(ctx, statement, params...)
	if err != nil {
		return nil, fmt.Errorf("unable to execute query: %w", err)
	}
	defer rows.Close()

	out := []any{}
	for rows.Next() {
		cols, err := rows.Columns()
		if err != nil {
			return nil, fmt.Errorf("unable to get columns: %w", err)
		}

		values := make([]interface{}, len(cols))
		valuePtrs := make([]interface{}, len(cols))
		for i := range values {
			valuePtrs[i] = &values[i]
		}

		if err := rows.Scan(valuePtrs...); err != nil {
			return nil, fmt.Errorf("unable to scan row: %w", err)
		}

		vMap := make(map[string]any)
		for i, col := range cols {
			vMap[col] = values[i]
		}
		out = append(out, vMap)
	}

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Retry the query on transient driver failures
  2. Check the statement produces a valid result set
  3. Inspect the wrapped driver error for the root cause
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at internal/sources/snowflake/snowflake.go:116 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/00b3fbc6266b692f. Report an issue: GitHub.