{"record":{"id":"be94fe12a554420e","repo":"googleapis/mcp-toolbox","slug":"error-processing-row-w-be94fe","errorCode":null,"errorMessage":"error processing row: %w","messagePattern":"error processing row: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/couchbase/couchbase.go","lineNumber":133,"sourceCode":"func (s *Source) CouchbaseQueryScanConsistency() uint {\n\treturn s.QueryScanConsistency\n}\n\nfunc (s *Source) RunSQL(statement string, params parameters.ParamValues) (any, error) {\n\tresults, err := s.CouchbaseScope().Query(statement, &gocb.QueryOptions{\n\t\tScanConsistency: gocb.QueryScanConsistency(s.CouchbaseQueryScanConsistency()),\n\t\tNamedParameters: params.AsMap(),\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to execute query: %w\", err)\n\t}\n\n\tout := []any{}\n\tfor results.Next() {\n\t\tvar result json.RawMessage\n\t\terr := results.Row(&result)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error processing row: %w\", err)\n\t\t}\n\t\tout = append(out, result)\n\t}\n\treturn out, nil\n}\n\nfunc (r Config) createCouchbaseOptions() (gocb.ClusterOptions, error) {\n\tcbOpts := gocb.ClusterOptions{}\n\n\tif r.Username != \"\" {\n\t\tauth := gocb.PasswordAuthenticator{\n\t\t\tUsername: r.Username,\n\t\t\tPassword: r.Password,\n\t\t}\n\t\tcbOpts.Authenticator = auth\n\t}\n\n\tvar clientCert, clientKey, caCert []byte","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/couchbase/couchbase.go#L115-L151","documentation":"Returned by Source.RunSQL when iterating the N1QL query results fails: results.Next() yields an error while decoding a row via results.Row(&result). The query was accepted and rows were streaming, but reading/decoding a row failed — often a mid-stream network interruption or a server-side error surfaced during iteration.","triggerScenarios":"The results stream breaks during iteration: connection to the query service dropped, cluster failover mid-query, query timeout/cancellation while streaming, or a row that cannot be decoded into json.RawMessage.","commonSituations":"Large result sets hitting streaming timeouts, unstable network to the Couchbase cluster, node failover during long queries, or query expiry (query_timeout) mid-iteration.","solutions":["Inspect the wrapped cause (%w) — if it is a network error, check cluster stability and connection settings","Add LIMIT/pagination to large queries so streams finish within timeouts","Increase query timeout in gocb QueryOptions or server query settings","Retry the query; transient stream drops during failover typically succeed on retry"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"out, err := source.RunSQL(ctx, statement, params)\nif err != nil && strings.Contains(err.Error(), \"error processing row\") {\n\t// transient stream failure: bounded retry with backoff\n\tfor i := 0; i < 3; i++ {\n\t\ttime.Sleep(time.Duration(1<<i) * 100 * time.Millisecond)\n\t\tif out, err = source.RunSQL(ctx, statement, params); err == nil {\n\t\t\tbreak\n\t\t}\n\t}\n}","preventionTips":["Paginate large result sets (LIMIT/OFFSET or keyset pagination) to shrink streams","Set adequate query timeouts for expected result sizes","Use stable network paths to the cluster; avoid querying during failovers","Add idempotent retry for read-only queries"],"tags":["couchbase","n1ql","streaming","row-decode"],"backgroundTag":"query-execution-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"}