gastownhall/beads · error

remote name cannot be empty

Error message

remote name cannot be empty

What it means

ValidateRemoteName rejects empty remote names before they are used as Dolt remote identifiers. Remote names become config keys and CLI/URL components, so an empty string is never valid. The library throws immediately to fail fast before any storage or network work.

Source

Thrown at internal/remotecache/url.go:194

// validateSCPURL validates an SCP-style URL (user@host:path)
func validateSCPURL(rawURL string) error {
	// Already matched gitSSHPattern, so structure is valid.
	// Extract host and verify no control chars (already checked above).
	atIdx := strings.Index(rawURL, "@")
	colonIdx := strings.Index(rawURL[atIdx:], ":")
	if atIdx < 0 || colonIdx < 0 {
		return fmt.Errorf("SCP-style URL must be in user@host:path format")
	}
	return nil
}

// ValidateRemoteName checks that a remote name is safe for use as a Dolt
// remote identifier. Names must start with a letter and contain only
// alphanumeric characters, hyphens, and underscores. Max 64 characters.
func ValidateRemoteName(name string) error {
	if name == "" {
		return fmt.Errorf("remote name cannot be empty")
	}
	if len(name) > 64 {
		return fmt.Errorf("remote name too long (max 64 characters)")
	}
	if strings.HasPrefix(name, "-") {
		return fmt.Errorf("remote name must not start with a dash")
	}
	if !validRemoteNameRegex.MatchString(name) {
		return fmt.Errorf("remote name must start with a letter and contain only alphanumeric characters, hyphens, and underscores")
	}
	return nil
}

// MatchesRemotePattern checks whether a URL matches a glob-style pattern.
// Patterns use path.Match semantics (e.g., "dolthub://myorg/*").
func MatchesRemotePattern(rawURL, pattern string) bool {
	matched, err := path.Match(pattern, rawURL)
	if err != nil {

View on GitHub (pinned to 71377f2769)

Solutions

  1. Supply a non-empty remote name (must start with a letter, max 64 chars).
  2. Check the script/config that supplies the name for unset or empty variables.
  3. Trim whitespace first — a whitespace-only string passes this check but fails the regex, so use the trimmed value as the name.

Example fix

// before
bd remote add "" https://dolthub.com/org/repo
// after
bd remote add origin https://dolthub.com/org/repo
Defensive patterns

Strategy: validation

Validate before calling

if name == "" {
    return fmt.Errorf("remote name is required")
}
if err := remotecache.ValidateRemoteName(name); err != nil {
    return err
}

Try / catch

if err := remotecache.ValidateRemoteName(name); err != nil {
    return fmt.Errorf("invalid remote name %q: %w", name, err)
}

Prevention

When it happens

Trigger: Calling ValidateRemoteName("") or any remote-adding flow (e.g. `bd remote add "" <url>`) where the name argument is the empty string, often from an unset variable or missing CLI flag.

Common situations: Shell scripts with unset REMOTE_NAME variables; CI configs where a name placeholder was never substituted; users running `remote add` and omitting the name positional argument.

Related errors


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