gastownhall/beads · error

CreateRemote: url must not be empty

Error message

CreateRemote: url 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 URL is an empty string. A remote needs a URL to point at; the check runs before remoteRepo.AddRemote.

Source

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

	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
	// the old URL first so a failed add can restore the remote instead of
	// leaving it deleted (bd-6dnrw.44 P3).
	var oldURL string

View on GitHub (pinned to 71377f2769)

Solutions

  1. Pass a full remote URL, e.g. bd remote add origin https://github.com/org/repo.git.
  2. In scripts, assert the URL variable is non-empty before invoking.
  3. Verify CI env provisioning for the repository URL variable.

Example fix

// before
url := os.Getenv("REMOTE_URL") // may be ""
uc.CreateRemote(ctx, name, url)
// after
if url == "" { return fmt.Errorf("REMOTE_URL is not set") }
uc.CreateRemote(ctx, name, url)
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

func validRemoteURL(url string) bool { return strings.HasPrefix(url, "https://") || strings.HasPrefix(url, "git@") || strings.HasPrefix(url, "file://") }

Prevention

When it happens

Trigger: Calling CreateRemote(ctx, name, "") — e.g., bd remote add origin with no URL argument, or an empty $URL variable in scripts.

Common situations: Copy-paste dropping the URL; environment variables for the remote host not set in CI; config templates with a placeholder URL never substituted.

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