googleapis/mcp-toolbox · error

unable to get column types: %w

Error message

unable to get column types: %w

What it means

RunSQL calls results.ColumnTypes() to determine the Go type of each column for correct value handling; failure is wrapped as "unable to get column types". Like the columns() failure, this happens after successful execution and points to connection/result-set problems, not SQL errors.

Source

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

		return nil, fmt.Errorf("unable to execute query: %w", err)
	}

	cols, err := results.Columns()
	if err != nil {
		return nil, fmt.Errorf("unable to retrieve rows column name: %w", err)
	}

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

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Retry the query to rule out a transient connection drop
  2. Check MindsDB server stability and logs around the time of the query
  3. Enable TCP keepalives / adjust pool settings to prevent stale connections
  4. Reduce result size with LIMIT if large result sets trigger the failure
Defensive patterns

Strategy: retry

Try / catch

colTypes, err := results.ColumnTypes()
if err != nil {
    results.Close()
    return retryQuery(ctx, statement, params) // single retry with backoff
}

Prevention

When it happens

Trigger: results.ColumnTypes() returns an error because the result set metadata cannot be fetched — dropped connection, aborted result set, or driver protocol issue after execution.

Common situations: MindsDB connection terminated mid-result-set (server restart, LB timeout); very large results causing driver buffer issues; unsupported column types from a MindsDB integration leaking through the MySQL protocol.

Related errors


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