gastownhall/beads · error

UpdateRemote: url must not be empty

Error message

UpdateRemote: url must not be empty

What it means

Argument-validation error from the Dolt remote use-case (UpdateRemote in internal/storage/domain/remote.go) thrown when the new remote URL is empty. The check precedes the remove-then-add sequence that emulates an atomic Dolt remote update, preventing a remote from being left deleted.

Source

Thrown at internal/storage/domain/remote.go:54

func (u *doltRemoteUseCaseImpl) CreateRemote(ctx context.Context, name, url string) error {
	if name == "" {
		return fmt.Errorf("CreateRemote: name must not be empty")
	}
	if url == "" {
		return fmt.Errorf("CreateRemote: url must not be empty")
	}
	if err := u.remoteRepo.AddRemote(ctx, name, url); err != nil {
		return fmt.Errorf("CreateRemote %s: %w", name, err)
	}
	return nil
}

func (u *doltRemoteUseCaseImpl) UpdateRemote(ctx context.Context, name, url string) error {
	if name == "" {
		return fmt.Errorf("UpdateRemote: name must not be empty")
	}
	if url == "" {
		return fmt.Errorf("UpdateRemote: url must not be empty")
	}
	// Dolt has no atomic remote update, so this is remove-then-add. Capture
	// the old URL first so a failed add can restore the remote instead of
	// leaving it deleted (bd-6dnrw.44 P3).
	var oldURL string
	if remotes, err := u.remoteRepo.ListRemotes(ctx); err == nil {
		for _, rem := range remotes {
			if rem.Name == name {
				oldURL = rem.URL
				break
			}
		}
	}
	if err := u.remoteRepo.RemoveRemote(ctx, name); err != nil {
		return fmt.Errorf("UpdateRemote %s: remove: %w", name, err)
	}
	if err := u.remoteRepo.AddRemote(ctx, name, url); err != nil {
		if oldURL != "" {

View on GitHub (pinned to 71377f2769)

Solutions

  1. Pass the full new URL when calling update.
  2. Validate the URL variable non-empty in scripts before invoking.
  3. If no URL change is intended, don't call UpdateRemote at all.

Example fix

// before
newURL := os.Getenv("NEW_URL")
uc.UpdateRemote(ctx, "origin", newURL) // "" would throw
// after
if newURL == "" { return nil } // nothing to update
uc.UpdateRemote(ctx, "origin", newURL)
Defensive patterns

Strategy: validation

Validate before calling

if url == "" { return fmt.Errorf("new remote URL is required") }

Type guard

func validRemoteURL(url string) bool { return strings.TrimSpace(url) != "" }

Prevention

When it happens

Trigger: Calling UpdateRemote(ctx, name, "") — e.g., an empty URL field in config, or a shell variable holding the new URL that was never set.

Common situations: CI secrets for the repository URL missing at update time; config regeneration wiping the URL field; accidental `bd remote update origin ""` in scripts.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/7b7e4bebc9b53dde. Report an issue: GitHub.