gastownhall/beads · error
dolt remote remove failed
Error message
dolt remote remove failed: %s: %w
What it means
RemoveCLIRemote runs `dolt remote remove <name>` with cmd.Dir=dbPath and, on non-zero exit or exec failure, returns dolt's combined output plus the exec error wrapped as "dolt remote remove failed". The dolt subprocess refused or could not perform the removal.
Solutions
- Read the %s portion of the error — dolt's output states whether the remote was missing vs. an environment failure
- Check `dolt remote -v` in dbPath; if the remote is absent, treat removal as already done
- Guard removal with FindCLIRemote so a missing remote is a no-op instead of an error
- Verify dolt is installed and no other bd/dolt process holds the database
- Fix filesystem permissions on dbPath if the failure is a write/lock error
Example fix
// before
if err := doltutil.RemoveCLIRemote(dbPath, name); err != nil {
return err // fails when remote does not exist
}
// after
if doltutil.FindCLIRemote(dbPath, name) != "" {
if err := doltutil.RemoveCLIRemote(dbPath, name); err != nil {
return fmt.Errorf("remove stale remote: %w", err)
}
} Defensive patterns
Strategy: try-catch
Validate before calling
if doltutil.FindCLIRemote(dbPath, name) == "" {
return nil // nothing to remove; avoid the dolt round-trip entirely
} Type guard
func isRemoteMissingError(err error) bool {
return err != nil && strings.Contains(strings.ToLower(err.Error()), "not found")
} Try / catch
if err := doltutil.RemoveCLIRemote(dbPath, name); err != nil {
if isRemoteMissingError(err) {
return nil // already gone — treat as success
}
return fmt.Errorf("removing dolt remote %q: %w", name, err)
} Prevention
- Check FindCLIRemote before removing so removal is idempotent
- Avoid running concurrent bd sync/dolt processes against the same database directory
- Ensure the dolt binary is present and dbPath is writable before mutating CLI remotes
When it happens
Trigger: Calling RemoveCLIRemote/EnsureCLIRemote when the named remote does not exist in the dolt DB; dbPath is not an initialized dolt database; the dolt binary is missing from PATH; a concurrent dolt process or stale lock blocks the operation; dbPath is read-only.
Common situations: Removing a remote that was never added or was already removed (non-idempotent caller); two bd processes racing on the same database; CI environment without dolt installed; database directory mounted read-only.
Related errors
- dolt remote add failed
- dolt remote -v failed
- bd
- peer remote uses git protocol and requires CLI routing
- add remote
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/b18eaf2fee9f1626.
Report an issue: GitHub.
Appendix: source
Thrown at internal/storage/doltutil/remotes.go:182
cmd := exec.Command("dolt", "remote", "add", name, url) // #nosec G204 -- validated argv
cmd.Dir = dbPath
out, err := cmd.CombinedOutput()
if err != nil {
return fmt.Errorf("dolt remote add failed: %s: %w", strings.TrimSpace(string(out)), err)
}
return nil
}
// RemoveCLIRemote removes a remote at the filesystem level via dolt CLI.
func RemoveCLIRemote(dbPath, name string) error {
if err := remotecache.ValidateRemoteName(name); err != nil {
return fmt.Errorf("invalid remote name: %w", err)
}
cmd := exec.Command("dolt", "remote", "remove", name) // #nosec G204 -- validated argv
cmd.Dir = dbPath
out, err := cmd.CombinedOutput()
if err != nil {
return fmt.Errorf("dolt remote remove failed: %s: %w", strings.TrimSpace(string(out)), err)
}
return nil
}
// FindCLIRemote returns the URL for a named remote in dbPath, or "" when the
// directory cannot be inspected or the remote is absent.
func FindCLIRemote(dbPath, name string) string {
remotes, err := ListCLIRemotes(dbPath)
if err != nil {
return ""
}
for _, r := range remotes {
if r.Name == name {
return r.URL
}
}
return ""
}View on GitHub (pinned to 71377f2769)