{"record":{"id":"023b8ead4fb03fab","repo":"googleapis/mcp-toolbox","slug":"unable-to-parse-row-w-023b8e","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/yugabytedb/yugabytedb.go","lineNumber":119,"sourceCode":"}\n\nfunc (s *Source) YugabyteDBPool() *pgxpool.Pool {\n\treturn s.Pool\n}\n\nfunc (s *Source) RunSQL(ctx context.Context, statement string, params []any) (any, error) {\n\tresults, err := s.YugabyteDBPool().Query(ctx, statement, params...)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to execute query: %w\", err)\n\t}\n\n\tfields := results.FieldDescriptions()\n\n\tout := []any{}\n\tfor results.Next() {\n\t\tv, err := results.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, f := range fields {\n\t\t\tval := sources.NormalizeValue(v[i], f.DataTypeOID)\n\t\t\tvMap[f.Name] = val\n\t\t}\n\t\tout = append(out, vMap)\n\t}\n\n\t// this will catch actual query execution errors\n\tif err := results.Err(); err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to execute query: %w\", err)\n\t}\n\n\treturn out, nil\n}\n\nfunc initYugabyteDBConnectionPool(ctx context.Context, tracer trace.Tracer, name, host, port, user, pass, dbname, loadBalance, topologyKeys, refreshInterval, explicitFallback, failedHostTTL string) (*pgxpool.Pool, error) {","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/yugabytedb/yugabytedb.go#L101-L137","documentation":"This error wraps a failure that occurred while iterating over result rows returned by a SQL query executed through the pgx/v5 driver in the YugabyteDB source. It is thrown by results.Values() inside the row-scanning loop of RunSQL, meaning the query itself started successfully but one specific row could not be decoded into Go values. It is a data-extraction failure, not a query-execution failure (that is handled separately by results.Err()).","triggerScenarios":"Calling RunSQL (or the yugabytedb execute_sql tool) and pgx fails to decode a row's values via Rows.Values() — typically when a column contains a type value that cannot be materialized at that point in iteration, or when the connection breaks mid-row fetch.","commonSituations":"Queries returning exotic or custom column types that pgx cannot decode, broken/terminated connections while streaming large result sets, driver/database version mismatches (e.g., YugabyteBCS/pgx protocol incompatibilities), or OOM/interruption while fetching rows.","solutions":["Inspect the wrapped error (%w) to identify the offending column or connection problem; fix the underlying cause it reports.","Restrict SELECT to columns with types pgx can decode, or cast unsupported columns in SQL (e.g., CAST(col AS text)).","Check network stability between the toolbox and the YugabyteDB node; retry the query if it was a transient connection drop.","Verify driver/pgx and YugabyteDB versions are compatible; upgrade dependencies if a decoding bug was fixed upstream.","Enable pgx logging (QueryTracer/Logger) for the exact failing statement and row."],"exampleFix":"// before\nrows, err := pool.Query(ctx, \"SELECT * FROM my_table\")\n// after\nrows, err := pool.Query(ctx, \"SELECT id, name, payload::text AS payload FROM my_table\")","handlingStrategy":"try-catch","validationCode":"// Prefer explicit columns and cast unsupported types in SQL before invoking the tool\n// SELECT id, name, payload::text AS payload FROM my_table;","typeGuard":null,"tryCatchPattern":"try {\n  const rows = await callTool(\"execute_sql\", { sql: \"SELECT ...\" });\n} catch (e) {\n  if (String(e.message).includes(\"unable to parse row\")) {\n    // inspect wrapped cause, narrow selected columns / cast types, retry\n  }\n}","preventionTips":["Select only columns whose types pgx decodes reliably; cast exotic types to text in SQL.","Keep pgx and YugabyteDB versions compatible and updated.","Ensure stable network connectivity to the YugabyteDB node to avoid mid-stream failures.","Test large/ad-hoc queries in ysqlsh first to spot problematic column types.","Validate queries against the actual schema before execution."],"tags":["database","yugabytedb","row-decoding","query-execution"],"backgroundTag":"row-scan-decode-failure","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"}