gastownhall/beads · error
list remotes: %w
Error message
list remotes: %w
What it means
ListRemotes queries the Dolt system table dolt_remotes to return all configured remotes (name and URL). This error wraps any failure of that SQL query — typically because the connection is not a Dolt database/session, the dolt_remotes table is unavailable in the current Dolt version, or the underlying connection/transport failed. It is thrown so callers get a single wrapped error identifying the 'list remotes' step.
Source
Thrown at internal/storage/versioncontrolops/remotes.go:14
package versioncontrolops
import (
"context"
"fmt"
"github.com/steveyegge/beads/internal/storage"
)
// ListRemotes returns all configured Dolt remotes (name and URL).
func ListRemotes(ctx context.Context, db DBConn) ([]storage.RemoteInfo, error) {
rows, err := db.QueryContext(ctx, "SELECT name, url FROM dolt_remotes")
if err != nil {
return nil, fmt.Errorf("list remotes: %w", err)
}
defer rows.Close()
var remotes []storage.RemoteInfo
for rows.Next() {
var r storage.RemoteInfo
if err := rows.Scan(&r.Name, &r.URL); err != nil {
return nil, fmt.Errorf("scan remote: %w", err)
}
remotes = append(remotes, r)
}
return remotes, rows.Err()
}
// RemoveRemote removes a configured Dolt remote.
func RemoveRemote(ctx context.Context, db DBConn, name string) error {
if _, err := db.ExecContext(ctx, "CALL DOLT_REMOTE('remove', ?)", name); err != nil {
return fmt.Errorf("remove remote %s: %w", name, err)View on GitHub (pinned to 71377f2769)
Solutions
- Verify the DBConn points at a running Dolt database (test with SELECT 1 and a Dolt version query)
- Check the Dolt server/engine is up and the DSN/addr is correct; restart if needed
- Confirm the Dolt version supports dolt_remotes (upgrade if older)
- Inspect the wrapped error with errors.Unwrap/errors.As for driver-level detail (timeout vs refused)
- Retry with a fresh context if the cause was deadline exceeded
Example fix
// before
remotes, err := versioncontrolops.ListRemotes(ctx, db)
if err != nil {
return err
}
// after
remotes, err := versioncontrolops.ListRemotes(ctx, db)
if err != nil {
if ctx.Err() != nil {
return fmt.Errorf("list remotes canceled: %w", ctx.Err())
}
return fmt.Errorf("list remotes: %w", err)
} Defensive patterns
Strategy: try-catch
Validate before calling
// Ensure the handle is a live Dolt connection before calling
if err := db.PingContext(ctx); err != nil {
return fmt.Errorf("dolt unavailable: %w", err)
} Type guard
func isContextErr(err error) bool {
return errors.Is(err, context.DeadlineExceeded) || errors.Is(err, context.Canceled)
} Try / catch
remotes, err := versioncontrolops.ListRemotes(ctx, db)
if err != nil {
if isContextErr(err) {
return fmt.Errorf("list remotes canceled/timed out: %w", err)
}
return fmt.Errorf("list remotes: %w", err)
} Prevention
- Ping the DB (or run a trivial query) before remotes operations
- Use a context with a sane timeout for Dolt queries
- Pin/verify the Dolt engine version in your deployment so dolt_remotes exists
- Keep connection DSNs in config and validate them at startup
When it happens
Trigger: Calling ListRemotes(ctx, db) when db.QueryContext(ctx, "SELECT name, url FROM dolt_remotes") fails: connection refused/closed, non-Dolt driver, unknown table (older Dolt or non-dolt schema), or context cancellation/timeout.
Common situations: Database not started or wrong DSN; running against a MySQL/SQLite handle instead of Dolt; Dolt version too old to expose dolt_remotes; network drop to a remote Dolt server; ctx deadline exceeded during a slow query.
Related errors
- failed to query cross-table duplicates: %w
- query cross-table duplicates: %w
- ErrTransaction
- ErrQuery
- ErrScan
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/d03eaa301820a2bf.
Report an issue: GitHub.