{"record":{"id":"48824e869058aa3e","repo":"googleapis/mcp-toolbox","slug":"unable-to-parse-row-w-48824e","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/mysql/mysql.go","lineNumber":160,"sourceCode":"\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\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\trow := orderedmap.Row{}\n\t\tfor i, name := range cols {\n\t\t\tval := rawValues[i]\n\t\t\tif val == nil {\n\t\t\t\trow.Add(name, nil)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconvertedValue, 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\trow.Add(name, convertedValue)\n\t\t}\n\t\tout = append(out, row)\n\t}\n","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/mysql/mysql.go#L142-L178","documentation":"This error wraps a failure from database/sql's rows.Scan() while reading a result row in the MySQL source's RunSQL tool. The Go MySQL driver could not copy a column value from the current row into the destination buffer (rawValues). It almost always indicates a value/type mismatch between what the driver returned and what the scan destinations expect, and the wrapped error names the offending column.","triggerScenarios":"Executing a query via the mysql run-sql tool whose result contains a value the driver cannot scan into the []byte/raw destination (e.g. certain BIT, unusual geometry, or corrupted binary values), or a driver/serve version mismatch causing column type descriptors the scanner cannot handle.","commonSituations":"Selecting exotic column types (BIT(M>1), GEOMETRY, malformed JSON), querying a proxy or older MySQL/MariaDB server with divergent protocol types, or data truncated by server-side max_allowed_packet issues.","solutions":["Read the wrapped error to identify the failing column and cast/convert it in SQL (e.g. CAST(col AS CHAR), HEX() for binary).","Upgrade the github.com/go-sql-driver/mysql dependency to the latest version.","Test the same query with a plain MySQL client to confirm the data itself is valid.","If BIT columns are the cause, select them as col+0 or CAST(col AS UNSIGNED)."],"exampleFix":"// before\nSELECT flags FROM permissions;\n// after\nSELECT CAST(flags AS UNSIGNED) AS flags FROM permissions;","handlingStrategy":"try-catch","validationCode":"// Validate the query result types before running through the tool:\nrows, err := db.QueryContext(ctx, \"SELECT flags FROM permissions LIMIT 1\")\nif err != nil { return err }\nctypes, err := rows.ColumnTypes()\nif err != nil { return err }\nfor _, ct := range ctypes {\n    fmt.Println(ct.Name(), ct.DatabaseTypeName()) // flag exotic types (BIT, GEOMETRY) and CAST them in SQL\n}","typeGuard":null,"tryCatchPattern":"out, err := toolboxClient.InvokeTool(ctx, \"run-sql\", params)\nif err != nil {\n    var parseErr *parseRowError // or match on the wrapped driver error\n    if strings.Contains(err.Error(), \"unable to parse row\") {\n        // inspect wrapped cause, adjust SQL casts, and retry once\n    }\n    return err\n}","preventionTips":["Avoid selecting exotic types (BIT, GEOMETRY, BLOB) directly; CAST or HEX them in SQL.","Keep the go-sql-driver/mysql dependency up to date.","Test queries against a plain mysql client before wiring them into the tool.","Pin MySQL server and driver versions to a known-compatible pair."],"tags":["mysql","sql","row-scan","database"],"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"}