gastownhall/beads · error

CreateRemote: name must not be empty

Error message

CreateRemote: name must not be empty

What it means

Argument-validation error from the Dolt remote use-case (CreateRemote in internal/storage/domain/remote.go) thrown when the remote name is an empty string. A Dolt remote must have a name (like a git remote) before it can be added via remoteRepo.AddRemote. Raised before any repository call.

Source

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

type RemoteSQLRepository interface {
	AddRemote(ctx context.Context, name, url string) error
	RemoveRemote(ctx context.Context, name string) error
	ListRemotes(ctx context.Context) ([]Remote, error)
}

func NewDoltRemoteUseCase(remoteRepo RemoteSQLRepository) DoltRemoteUseCase {
	return &doltRemoteUseCaseImpl{remoteRepo: remoteRepo}
}

type doltRemoteUseCaseImpl struct {
	remoteRepo RemoteSQLRepository
}

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

View on GitHub (pinned to 71377f2769)

Solutions

  1. Supply a non-empty remote name, e.g. bd remote add origin <url>.
  2. In scripts, validate the variable is set: [ -n "$REMOTE_NAME" ] || exit 1.
  3. Check config-driven callers for empty name fields and default to 'origin'.

Example fix

// before
name := os.Getenv("REMOTE_NAME") // may be ""
uc.CreateRemote(ctx, name, url)
// after
if name == "" { name = "origin" }
if err := uc.CreateRemote(ctx, name, url); err != nil { return err }
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

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

Prevention

When it happens

Trigger: Calling CreateRemote(ctx, "", url) — typically from bd remote add with a missing name argument or an empty shell variable expansion like bd remote add "$NAME" "$URL" where NAME is unset.

Common situations: Shell scripts with unset environment variables ($REMOTE_NAME expands to empty); CLI flag parsing that drops a positional argument; config files with a blank remote name key.

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/6d45e432d75eb8b0. Report an issue: GitHub.