gastownhall/beads · error

UpdateRemote: name must not be empty

Error message

UpdateRemote: name 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 remote name is empty. Since Dolt has no atomic remote update, the use-case does remove-then-add; validation of both arguments happens before that destructive sequence begins.

Source

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

var _ DoltRemoteUseCase = (*doltRemoteUseCaseImpl)(nil)

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)

View on GitHub (pinned to 71377f2769)

Solutions

  1. Provide the existing remote's name (verify with bd remote list).
  2. In scripts, validate the name variable before calling update.
  3. If the remote truly doesn't have a name yet, use CreateRemote instead of UpdateRemote.

Example fix

// before
for _, r := range cfg.Remotes { uc.UpdateRemote(ctx, r.Name, r.URL) } // Name may be ""
// after
for _, r := range cfg.Remotes {
    if r.Name == "" || r.URL == "" { continue }
    uc.UpdateRemote(ctx, r.Name, r.URL)
}
Defensive patterns

Strategy: validation

Validate before calling

if name == "" { return fmt.Errorf("remote name is required for update") }

Type guard

func validRemoteName(name string) bool { return strings.TrimSpace(name) != "" }

Prevention

When it happens

Trigger: Calling UpdateRemote(ctx, "", url) — a missing/unset remote-name argument in scripts or config-driven updates.

Common situations: Shell loops iterating remotes where the name variable loses scope; config files with blank remote keys; templated CI scripts with unfilled placeholders.

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/089117b723332e36. Report an issue: GitHub.