{"record":{"id":"a284103c04e52e2c","repo":"googleapis/mcp-toolbox","slug":"unable-to-parse-row-w-a28410","errorCode":null,"errorMessage":"unable to parse row: %w","messagePattern":"unable to parse row: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/mindsdb/mindsdb.go","lineNumber":139,"sourceCode":"\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)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"errors encountered when converting values: %w\", err)\n\t\t\t}\n\t\t}\n\t\tout = append(out, vMap)\n\t}\n","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/mindsdb/mindsdb.go#L121-L157","documentation":"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\".","triggerScenarios":"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.","commonSituations":"MindsDB predictions returning exotic or inconsistent column types across rows; connections going stale mid-iteration; driver version incompatibility with MindsDB's MySQL protocol dialect.","solutions":["Read the wrapped driver error to identify the offending column and type","Update go-sql-driver/mysql to a version compatible with your MindsDB release","Cast/convert problematic columns in SQL (e.g. CAST(col AS CHAR)) to avoid scan type mismatches","Retry, and check for server-side connection aborts if the failure is intermittent"],"exampleFix":"// before\nSELECT prediction, RAW_confidence FROM mindsdb.model_a  # exotic type\n// after\nSELECT prediction, CAST(confidence AS DOUBLE) AS confidence FROM mindsdb.model_a","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := results.Scan(values...)\nif err != nil {\n    var mysqlErr *mysql.MySQLError\n    if errors.As(err, &mysqlErr) {\n        // log row index and failing column for diagnosis\n    }\n    return fmt.Errorf(\"row %d scan failed: %w\", rowIndex, err)\n}","preventionTips":["CAST exotic MindsDB column types to standard SQL types in queries","Use *interface{} destinations (as this code does) to accept any type","Keep the MySQL driver current to handle MindsDB protocol type changes"],"tags":["mindsdb","mysql","scan","row-parsing"],"backgroundTag":"row-scan-failed","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"}