gastownhall/beads · error
db: ListRemotes: rows: %w
Error message
db: ListRemotes: rows: %w
What it means
This error is returned by ListRemotes after iterating rows, when rows.Err() reports an error encountered during iteration (e.g. the connection dropped or the query was aborted mid-result-set). The scan of earlier rows succeeded, but the full result was not retrieved.
Source
Thrown at internal/storage/domain/db/remote.go:54
}
func (r *remoteSQLRepositoryImpl) ListRemotes(ctx context.Context) ([]domain.Remote, error) {
rows, err := r.runner.QueryContext(ctx, "SELECT name, url FROM dolt_remotes")
if err != nil {
return nil, fmt.Errorf("db: ListRemotes: query: %w", err)
}
defer rows.Close()
var remotes []domain.Remote
for rows.Next() {
var rem domain.Remote
if err := rows.Scan(&rem.Name, &rem.URL); err != nil {
return nil, fmt.Errorf("db: ListRemotes: scan: %w", err)
}
remotes = append(remotes, rem)
}
if err := rows.Err(); err != nil {
return nil, fmt.Errorf("db: ListRemotes: rows: %w", err)
}
return remotes, nil
}
View on GitHub (pinned to 71377f2769)
Solutions
- Read the wrapped cause after 'rows:' for the driver error
- Retry ListRemotes with a fresh context if the cause is transient (connection reset, deadline exceeded)
- Increase the context timeout when listing against a slow/remote SQL server
- Check server logs for aborted connections around the failure time
Example fix
// before
ctx := context.Background()
remotes, err := store.ListRemotes(ctx)
// after
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
remotes, err := store.ListRemotes(ctx)
if err != nil && isTransient(err) { remotes, err = store.ListRemotes(ctx) } Defensive patterns
Strategy: retry
Validate before calling
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) defer cancel() // generous timeout avoids mid-iteration aborts
Type guard
func isRowsErr(err error) bool {
return err != nil && strings.Contains(err.Error(), "ListRemotes: rows:")
} Try / catch
var remotes []domain.Remote
var err error
for i := 0; i < 3; i++ {
remotes, err = store.ListRemotes(ctx)
if err == nil || !isTransient(err) { break }
time.Sleep(backoff(i))
} Prevention
- Use contexts with adequate timeouts for remote listing
- Retry transient connection errors with backoff
- Monitor SQL server stability; investigate aborted connections
When it happens
Trigger: Calling ListRemotes when the database connection fails or the context is cancelled while streaming rows from the dolt_remotes query — any driver-level error surfaced only via rows.Err() after Next() returns false.
Common situations: Long-lived result set interrupted by network blip to the SQL server; context timeout expiring while listing many remotes; Dolt server killed mid-query.
Related errors
- failed to begin transaction: %w
- failed to recompute is_blocked: %w
- failed to commit is_blocked repairs: %w
- failed to query orphaned dependencies: %w
- row iteration error: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/063f95c1178e4c50.
Report an issue: GitHub.