{"record":{"id":"d03eaa301820a2bf","repo":"gastownhall/beads","slug":"list-remotes-w-d03eaa","errorCode":null,"errorMessage":"list remotes: %w","messagePattern":"list remotes: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/versioncontrolops/remotes.go","lineNumber":14,"sourceCode":"package versioncontrolops\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/steveyegge/beads/internal/storage\"\n)\n\n// ListRemotes returns all configured Dolt remotes (name and URL).\nfunc ListRemotes(ctx context.Context, db DBConn) ([]storage.RemoteInfo, error) {\n\trows, err := db.QueryContext(ctx, \"SELECT name, url FROM dolt_remotes\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"list remotes: %w\", err)\n\t}\n\tdefer rows.Close()\n\n\tvar remotes []storage.RemoteInfo\n\tfor rows.Next() {\n\t\tvar r storage.RemoteInfo\n\t\tif err := rows.Scan(&r.Name, &r.URL); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"scan remote: %w\", err)\n\t\t}\n\t\tremotes = append(remotes, r)\n\t}\n\treturn remotes, rows.Err()\n}\n\n// RemoveRemote removes a configured Dolt remote.\nfunc RemoveRemote(ctx context.Context, db DBConn, name string) error {\n\tif _, err := db.ExecContext(ctx, \"CALL DOLT_REMOTE('remove', ?)\", name); err != nil {\n\t\treturn fmt.Errorf(\"remove remote %s: %w\", name, err)","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/versioncontrolops/remotes.go#L1-L32","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nremotes, err := versioncontrolops.ListRemotes(ctx, db)\nif err != nil {\n\treturn err\n}\n// after\nremotes, err := versioncontrolops.ListRemotes(ctx, db)\nif err != nil {\n\tif ctx.Err() != nil {\n\t\treturn fmt.Errorf(\"list remotes canceled: %w\", ctx.Err())\n\t}\n\treturn fmt.Errorf(\"list remotes: %w\", err)\n}","handlingStrategy":"try-catch","validationCode":"// Ensure the handle is a live Dolt connection before calling\nif err := db.PingContext(ctx); err != nil {\n\treturn fmt.Errorf(\"dolt unavailable: %w\", err)\n}","typeGuard":"func isContextErr(err error) bool {\n\treturn errors.Is(err, context.DeadlineExceeded) || errors.Is(err, context.Canceled)\n}","tryCatchPattern":"remotes, err := versioncontrolops.ListRemotes(ctx, db)\nif err != nil {\n\tif isContextErr(err) {\n\t\treturn fmt.Errorf(\"list remotes canceled/timed out: %w\", err)\n\t}\n\treturn fmt.Errorf(\"list remotes: %w\", err)\n}","preventionTips":["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"],"tags":["dolt","database","sql-query","remotes"],"backgroundTag":"dolt-query-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}