googleapis/mcp-toolbox · error

unable to execute query: %w

Error message

unable to execute query: %w

What it means

QueryxContext failed executing the statement in RunSQL — the SQL was rejected by Snowflake (syntax, unknown object, permissions) or the connection dropped mid-query.

Source

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

	return false
}

func (s *Source) SourceType() string {
	return SourceType
}

func (s *Source) ToConfig() sources.SourceConfig {
	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)

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Check the SQL statement syntax and referenced objects
  2. Verify the role has privileges on the warehouse/schema/table
  3. Retry on transient network or session-expiration errors
Defensive patterns

Strategy: retry

When it happens

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