googleapis/mcp-toolbox · error

unable to get column types: %w

Error message

unable to get column types: %w

What it means

results.ColumnTypes() failed to fetch column type metadata in RunSQL after columns were listed — the driver's type introspection failed for at least one column or the connection degraded.

Source

Thrown at internal/sources/tidb/tidb.go:134

		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
			}

			// mysql driver return []uint8 type for "TEXT", "VARCHAR", and "NVARCHAR"
			// we'll need to cast it back to string

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Retry the query
  2. Check for unusual column types in the result set
  3. Inspect the wrapped driver error for the failing column
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at internal/sources/tidb/tidb.go:134 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/a900e18a96a51792. Report an issue: GitHub.