googleapis/mcp-toolbox · error

unable to parse row: %w

Error message

unable to parse row: %w

What it means

iter.Next returned a non-Done error while streaming Spanner rows in processRows — the query failed mid-stream (session loss, cancellation, or deserialization of the row failed).

Source

Thrown at internal/sources/spanner/spanner.go:140

	return s.UseClientOAuth
}

func (s *Source) GetCatalogClient(ctx context.Context, tokenString string) (*dataplexapi.CatalogClient, error) {
	return s.dataplexMgr.GetCatalogClient(ctx, tokenString)
}

// processRows iterates over the spanner.RowIterator and converts each row to a map[string]any.
func processRows(iter *spanner.RowIterator) ([]any, error) {
	out := []any{}
	defer iter.Stop()

	for {
		row, err := iter.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			return nil, fmt.Errorf("unable to parse row: %w", err)
		}

		rowMap := orderedmap.Row{}
		cols := row.ColumnNames()
		for i, c := range cols {
			if c == "object_details" { // for list graphs or list tables
				val := row.ColumnValue(i)
				if val == nil { // ColumnValue returns the Cloud Spanner Value of column i, or nil for invalid column.
					rowMap.Add(c, nil)
				} else {
					jsonString, ok := val.AsInterface().(string)
					if !ok {
						return nil, fmt.Errorf("column 'object_details' is not a string, but %T", val.AsInterface())
					}
					var details map[string]any
					if err := json.Unmarshal([]byte(jsonString), &details); err != nil {
						return nil, fmt.Errorf("unable to unmarshal JSON: %w", err)
					}

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Inspect the wrapped Spanner error for the root cause
  2. Check the query and session/partition validity
  3. Retry the read on transient session errors
Defensive patterns

Strategy: type-guard

When it happens

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

Common situations: See trigger scenarios.

Understand the failure class


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