googleapis/mcp-toolbox · error

unable to scan row: %w

Error message

unable to scan row: %w

What it means

rows.Scan failed to copy the current row's column values into the prepared destination slice — typically a driver-level type conversion mismatch between the Snowflake column value and the scanned interface{}.

Source

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

		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)
	}

	if err := rows.Err(); err != nil {
		return nil, fmt.Errorf("row iteration error: %w", err)
	}

	return out, nil
}

func initSnowflakeConnection(ctx context.Context, tracer trace.Tracer, name, account, user, password, database, schema, warehouse, role string) (*sqlx.DB, error) {
	//nolint:all // Reassigned ctx

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Inspect the wrapped driver error for the failing column and type
  2. Cast or convert problematic column types in the query
  3. Retry on transient mid-iteration failures
Defensive patterns

Strategy: type-guard

When it happens

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