{"record":{"id":"6d45e432d75eb8b0","repo":"gastownhall/beads","slug":"createremote-name-must-not-be-empty","errorCode":null,"errorMessage":"CreateRemote: name must not be empty","messagePattern":"CreateRemote: name must not be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/domain/remote.go","lineNumber":38,"sourceCode":"type RemoteSQLRepository interface {\n\tAddRemote(ctx context.Context, name, url string) error\n\tRemoveRemote(ctx context.Context, name string) error\n\tListRemotes(ctx context.Context) ([]Remote, error)\n}\n\nfunc NewDoltRemoteUseCase(remoteRepo RemoteSQLRepository) DoltRemoteUseCase {\n\treturn &doltRemoteUseCaseImpl{remoteRepo: remoteRepo}\n}\n\ntype doltRemoteUseCaseImpl struct {\n\tremoteRepo RemoteSQLRepository\n}\n\nvar _ DoltRemoteUseCase = (*doltRemoteUseCaseImpl)(nil)\n\nfunc (u *doltRemoteUseCaseImpl) CreateRemote(ctx context.Context, name, url string) error {\n\tif name == \"\" {\n\t\treturn fmt.Errorf(\"CreateRemote: name must not be empty\")\n\t}\n\tif url == \"\" {\n\t\treturn fmt.Errorf(\"CreateRemote: url must not be empty\")\n\t}\n\tif err := u.remoteRepo.AddRemote(ctx, name, url); err != nil {\n\t\treturn fmt.Errorf(\"CreateRemote %s: %w\", name, err)\n\t}\n\treturn nil\n}\n\nfunc (u *doltRemoteUseCaseImpl) UpdateRemote(ctx context.Context, name, url string) error {\n\tif name == \"\" {\n\t\treturn fmt.Errorf(\"UpdateRemote: name must not be empty\")\n\t}\n\tif url == \"\" {\n\t\treturn fmt.Errorf(\"UpdateRemote: url must not be empty\")\n\t}\n\t// Dolt has no atomic remote update, so this is remove-then-add. Capture","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/domain/remote.go#L20-L56","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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'."],"exampleFix":"// before\nname := os.Getenv(\"REMOTE_NAME\") // may be \"\"\nuc.CreateRemote(ctx, name, url)\n// after\nif name == \"\" { name = \"origin\" }\nif err := uc.CreateRemote(ctx, name, url); err != nil { return err }","handlingStrategy":"validation","validationCode":"if name == \"\" { return fmt.Errorf(\"remote name is required\") }","typeGuard":"func validRemoteName(name string) bool { return strings.TrimSpace(name) != \"\" }","tryCatchPattern":null,"preventionTips":["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."],"tags":["go","validation","remote","argument-error"],"backgroundTag":"missing-required-argument","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}