{"record":{"id":"fc22055147fd4ad6","repo":"googleapis/mcp-toolbox","slug":"unable-to-get-column-types-w-fc2205","errorCode":null,"errorMessage":"unable to get column types: %w","messagePattern":"unable to get column types: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/mindsdb/mindsdb.go","lineNumber":132,"sourceCode":"\t\treturn nil, fmt.Errorf(\"unable to execute query: %w\", err)\n\t}\n\n\tcols, err := results.Columns()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to retrieve rows column name: %w\", err)\n\t}\n\n\t// create an array of values for each column, which can be re-used to scan each row\n\trawValues := make([]any, len(cols))\n\tvalues := make([]any, len(cols))\n\tfor i := range rawValues {\n\t\tvalues[i] = &rawValues[i]\n\t}\n\tdefer results.Close()\n\n\tcolTypes, err := results.ColumnTypes()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to get column types: %w\", err)\n\t}\n\n\tout := []any{}\n\tfor results.Next() {\n\t\terr := results.Scan(values...)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to parse row: %w\", err)\n\t\t}\n\t\tvMap := make(map[string]any)\n\t\tfor i, name := range cols {\n\t\t\tval := rawValues[i]\n\t\t\tif val == nil {\n\t\t\t\tvMap[name] = nil\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// MindsDB uses mysql driver\n\t\t\tvMap[name], err = mysqlcommon.ConvertToType(colTypes[i], val)","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/mindsdb/mindsdb.go#L114-L150","documentation":"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.","triggerScenarios":"results.ColumnTypes() returns an error because the result set metadata cannot be fetched — dropped connection, aborted result set, or driver protocol issue after execution.","commonSituations":"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.","solutions":["Retry the query to rule out a transient connection drop","Check MindsDB server stability and logs around the time of the query","Enable TCP keepalives / adjust pool settings to prevent stale connections","Reduce result size with LIMIT if large result sets trigger the failure"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"colTypes, err := results.ColumnTypes()\nif err != nil {\n    results.Close()\n    return retryQuery(ctx, statement, params) // single retry with backoff\n}","preventionTips":["Keep go-sql-driver/mysql up to date with your MindsDB version","Use LIMIT to cap large result sets","Set pool connection lifetimes to avoid stale connections"],"tags":["mindsdb","mysql","resultset","metadata"],"backgroundTag":"result-metadata-unavailable","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}