{"record":{"id":"a45201ece840a07b","repo":"gastownhall/beads","slug":"list-existing-remotes-w","errorCode":null,"errorMessage":"list existing remotes: %w","messagePattern":"list existing remotes: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/dolt.go","lineNumber":1548,"sourceCode":"\t\treturn false\n\t}\n\tresponse = strings.TrimSpace(strings.ToLower(response))\n\treturn response == \"y\" || response == \"yes\"\n}\n\nfunc findDoltRemoteURL(remotes []storage.RemoteInfo, name string) string {\n\tfor _, remote := range remotes {\n\t\tif remote.Name == name {\n\t\t\treturn remote.URL\n\t\t}\n\t}\n\treturn \"\"\n}\n\nfunc ensureDoltRemote(ctx context.Context, st doltRemoteAddStore, name, url string, confirm doltRemoteOverwriteConfirmer) (doltRemoteAddResult, error) {\n\tremotes, err := st.ListRemotes(ctx)\n\tif err != nil {\n\t\treturn doltRemoteAddResult{}, fmt.Errorf(\"list existing remotes: %w\", err)\n\t}\n\n\texistingURL := findDoltRemoteURL(remotes, name)\n\texistingFromDiskOnly := false\n\tif existingURL == \"\" {\n\t\t// An empty listing is not proof the remote is absent: a freshly\n\t\t// (auto-)started sql-server can report empty dolt_remotes while the\n\t\t// remote is persisted on disk (GH#2118, wy-6k7f7). Recover the\n\t\t// persisted URL so the add gets the same match/confirm treatment it\n\t\t// would after the window, instead of silently writing over an\n\t\t// invisible remote.\n\t\texistingURL = findDoltRemoteURL(persistedRemoteInfosFor(st), name)\n\t\texistingFromDiskOnly = existingURL != \"\"\n\t}\n\tif existingURL == \"\" {\n\t\tif err := st.AddRemote(ctx, name, url); err != nil {\n\t\t\treturn doltRemoteAddResult{}, fmt.Errorf(\"add remote %s: %w\", name, err)\n\t\t}","sourceCodeStart":1530,"sourceCodeEnd":1566,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/dolt.go#L1530-L1566","documentation":"ensureDoltRemote first lists existing Dolt remotes via st.ListRemotes(ctx) to decide whether the requested remote already exists. If listing fails (server unavailable, driver error, permissions), the error is wrapped as 'list existing remotes'. This is the entry point of remote add/push flows and fails before any mutation.","triggerScenarios":"`bd dolt remote add` or `bd dolt push` when ListRemotes errors: the embedded Dolt server failed to start, database corruption, or driver-level I/O errors.","commonSituations":"Dolt server not running / crashed; another bd process holds conflicting state; corrupted .beads dolt directory after a crash or version downgrade.","solutions":["Read the wrapped cause: if the server failed to start, restart it or re-run the command (cold start is retried automatically)","Check .beads dolt storage integrity; consult `bd doctor` for database issues","Retry after resolving any driver/permission error reported underneath","If the DB is corrupted, restore from git-synced refs/dolt/data or re-clone the remote per docs"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// ensure the workspace DB is reachable before remote ops\nif _, err := os.Stat(filepath.Join(beadsDir, \"beads.db\")); err != nil {\n  return fmt.Errorf(\"beads database missing: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"res, err := ensureDoltRemote(ctx, st, name, url, confirm)\nif err != nil {\n  if strings.Contains(err.Error(), \"list existing remotes\") {\n    // transient server failure: back off and retry once\n    time.Sleep(time.Second)\n    return ensureDoltRemote(ctx, st, name, url, confirm)\n  }\n  return res, err\n}","preventionTips":["Let bd start/stop its Dolt server; avoid killing it mid-operation","Run `bd doctor` if sync commands start failing on listing","Restore from git refs/dolt/data after any corruption instead of hacking the DB dir","Avoid concurrent bd processes on the same workspace"],"tags":["dolt","remote","storage","server"],"backgroundTag":"dolt-list-remotes-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}