googleapis/mcp-toolbox · error

unable to parse row: %w

Error message

unable to parse row: %w

What it means

While iterating rows with results.Next(), each row is scanned into pre-allocated value slots; a scan failure (type mismatch between the MySQL column type and the destination, NULL in a non-nullable destination, or corrupt row data) is wrapped as "unable to parse row".

Source

Thrown at internal/sources/mindsdb/mindsdb.go:139

	// 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...)
		if err != nil {
			return nil, fmt.Errorf("unable to parse row: %w", err)
		}
		vMap := make(map[string]any)
		for i, name := range cols {
			val := rawValues[i]
			if val == nil {
				vMap[name] = nil
				continue
			}

			// MindsDB uses mysql driver
			vMap[name], err = mysqlcommon.ConvertToType(colTypes[i], val)
			if err != nil {
				return nil, fmt.Errorf("errors encountered when converting values: %w", err)
			}
		}
		out = append(out, vMap)
	}

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Read the wrapped driver error to identify the offending column and type
  2. Update go-sql-driver/mysql to a version compatible with your MindsDB release
  3. Cast/convert problematic columns in SQL (e.g. CAST(col AS CHAR)) to avoid scan type mismatches
  4. Retry, and check for server-side connection aborts if the failure is intermittent

Example fix

// before
SELECT prediction, RAW_confidence FROM mindsdb.model_a  # exotic type
// after
SELECT prediction, CAST(confidence AS DOUBLE) AS confidence FROM mindsdb.model_a
Defensive patterns

Strategy: try-catch

Try / catch

err := results.Scan(values...)
if err != nil {
    var mysqlErr *mysql.MySQLError
    if errors.As(err, &mysqlErr) {
        // log row index and failing column for diagnosis
    }
    return fmt.Errorf("row %d scan failed: %w", rowIndex, err)
}

Prevention

When it happens

Trigger: results.Scan(values...) fails for a specific row — e.g. a MindsDB column type the driver can't convert into *interface{} destinations, binary/protocol corruption, or out-of-range values.

Common situations: MindsDB predictions returning exotic or inconsistent column types across rows; connections going stale mid-iteration; driver version incompatibility with MindsDB's MySQL protocol dialect.

Understand the failure class

Related errors


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