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. CaptureView on GitHub (pinned to 71377f2769)
Solutions
- Supply a non-empty remote name, e.g. bd remote add origin <url>.
- In scripts, validate the variable is set: [ -n "$REMOTE_NAME" ] || exit 1.
- 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
- Default the remote name to "origin" when unset.
- Use ${VAR:?msg} shell expansion to fail fast on unset variables.
- Validate CLI args before invoking the use-case.
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
- CreateRemote: url must not be empty
- UpdateRemote: name must not be empty
- UpdateRemote: url must not be empty
- inherit labels: childID must not be empty
- inherit labels: parentID must not be empty
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/6d45e432d75eb8b0.
Report an issue: GitHub.