{"record":{"id":"089117b723332e36","repo":"gastownhall/beads","slug":"updateremote-name-must-not-be-empty","errorCode":null,"errorMessage":"UpdateRemote: name must not be empty","messagePattern":"UpdateRemote: name must not be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/domain/remote.go","lineNumber":51,"sourceCode":"\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\n\t// the old URL first so a failed add can restore the remote instead of\n\t// leaving it deleted (bd-6dnrw.44 P3).\n\tvar oldURL string\n\tif remotes, err := u.remoteRepo.ListRemotes(ctx); err == nil {\n\t\tfor _, rem := range remotes {\n\t\t\tif rem.Name == name {\n\t\t\t\toldURL = rem.URL\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tif err := u.remoteRepo.RemoveRemote(ctx, name); err != nil {\n\t\treturn fmt.Errorf(\"UpdateRemote %s: remove: %w\", name, err)","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/domain/remote.go#L33-L69","documentation":"Argument-validation error from the Dolt remote use-case (UpdateRemote in internal/storage/domain/remote.go) thrown when the remote name is empty. Since Dolt has no atomic remote update, the use-case does remove-then-add; validation of both arguments happens before that destructive sequence begins.","triggerScenarios":"Calling UpdateRemote(ctx, \"\", url) — a missing/unset remote-name argument in scripts or config-driven updates.","commonSituations":"Shell loops iterating remotes where the name variable loses scope; config files with blank remote keys; templated CI scripts with unfilled placeholders.","solutions":["Provide the existing remote's name (verify with bd remote list).","In scripts, validate the name variable before calling update.","If the remote truly doesn't have a name yet, use CreateRemote instead of UpdateRemote."],"exampleFix":"// before\nfor _, r := range cfg.Remotes { uc.UpdateRemote(ctx, r.Name, r.URL) } // Name may be \"\"\n// after\nfor _, r := range cfg.Remotes {\n    if r.Name == \"\" || r.URL == \"\" { continue }\n    uc.UpdateRemote(ctx, r.Name, r.URL)\n}","handlingStrategy":"validation","validationCode":"if name == \"\" { return fmt.Errorf(\"remote name is required for update\") }","typeGuard":"func validRemoteName(name string) bool { return strings.TrimSpace(name) != \"\" }","tryCatchPattern":null,"preventionTips":["Verify remote names with a list call before batch updates.","Skip config entries with blank names instead of passing them through.","Validate loop variables aren't shadowed or emptied in scripts."],"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"}