{"record":{"id":"b34cdc6d2948092b","repo":"gastownhall/beads","slug":"remote-name-cannot-be-empty","errorCode":null,"errorMessage":"remote name cannot be empty","messagePattern":"remote name cannot be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/remotecache/url.go","lineNumber":194,"sourceCode":"\n// validateSCPURL validates an SCP-style URL (user@host:path)\nfunc validateSCPURL(rawURL string) error {\n\t// Already matched gitSSHPattern, so structure is valid.\n\t// Extract host and verify no control chars (already checked above).\n\tatIdx := strings.Index(rawURL, \"@\")\n\tcolonIdx := strings.Index(rawURL[atIdx:], \":\")\n\tif atIdx < 0 || colonIdx < 0 {\n\t\treturn fmt.Errorf(\"SCP-style URL must be in user@host:path format\")\n\t}\n\treturn nil\n}\n\n// ValidateRemoteName checks that a remote name is safe for use as a Dolt\n// remote identifier. Names must start with a letter and contain only\n// alphanumeric characters, hyphens, and underscores. Max 64 characters.\nfunc ValidateRemoteName(name string) error {\n\tif name == \"\" {\n\t\treturn fmt.Errorf(\"remote name cannot be empty\")\n\t}\n\tif len(name) > 64 {\n\t\treturn fmt.Errorf(\"remote name too long (max 64 characters)\")\n\t}\n\tif strings.HasPrefix(name, \"-\") {\n\t\treturn fmt.Errorf(\"remote name must not start with a dash\")\n\t}\n\tif !validRemoteNameRegex.MatchString(name) {\n\t\treturn fmt.Errorf(\"remote name must start with a letter and contain only alphanumeric characters, hyphens, and underscores\")\n\t}\n\treturn nil\n}\n\n// MatchesRemotePattern checks whether a URL matches a glob-style pattern.\n// Patterns use path.Match semantics (e.g., \"dolthub://myorg/*\").\nfunc MatchesRemotePattern(rawURL, pattern string) bool {\n\tmatched, err := path.Match(pattern, rawURL)\n\tif err != nil {","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/remotecache/url.go#L176-L212","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Supply a non-empty remote name (must start with a letter, max 64 chars).","Check the script/config that supplies the name for unset or empty variables.","Trim whitespace first — a whitespace-only string passes this check but fails the regex, so use the trimmed value as the name."],"exampleFix":"// before\nbd remote add \"\" https://dolthub.com/org/repo\n// after\nbd remote add origin https://dolthub.com/org/repo","handlingStrategy":"validation","validationCode":"if name == \"\" {\n    return fmt.Errorf(\"remote name is required\")\n}\nif err := remotecache.ValidateRemoteName(name); err != nil {\n    return err\n}","typeGuard":null,"tryCatchPattern":"if err := remotecache.ValidateRemoteName(name); err != nil {\n    return fmt.Errorf(\"invalid remote name %q: %w\", name, err)\n}","preventionTips":["Default remote names to 'origin' when the flag/variable is empty.","Trim and validate CLI inputs before constructing remote operations.","Test remote-add code paths with an unset-name scenario."],"tags":["validation","remote","configuration"],"backgroundTag":"invalid-remote-name","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}