{"record":{"id":"7b7e4bebc9b53dde","repo":"gastownhall/beads","slug":"updateremote-url-must-not-be-empty","errorCode":null,"errorMessage":"UpdateRemote: url must not be empty","messagePattern":"UpdateRemote: url must not be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/domain/remote.go","lineNumber":54,"sourceCode":"func (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)\n\t}\n\tif err := u.remoteRepo.AddRemote(ctx, name, url); err != nil {\n\t\tif oldURL != \"\" {","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/domain/remote.go#L36-L72","documentation":"Argument-validation error from the Dolt remote use-case (UpdateRemote in internal/storage/domain/remote.go) thrown when the new remote URL is empty. The check precedes the remove-then-add sequence that emulates an atomic Dolt remote update, preventing a remote from being left deleted.","triggerScenarios":"Calling UpdateRemote(ctx, name, \"\") — e.g., an empty URL field in config, or a shell variable holding the new URL that was never set.","commonSituations":"CI secrets for the repository URL missing at update time; config regeneration wiping the URL field; accidental `bd remote update origin \"\"` in scripts.","solutions":["Pass the full new URL when calling update.","Validate the URL variable non-empty in scripts before invoking.","If no URL change is intended, don't call UpdateRemote at all."],"exampleFix":"// before\nnewURL := os.Getenv(\"NEW_URL\")\nuc.UpdateRemote(ctx, \"origin\", newURL) // \"\" would throw\n// after\nif newURL == \"\" { return nil } // nothing to update\nuc.UpdateRemote(ctx, \"origin\", newURL)","handlingStrategy":"validation","validationCode":"if url == \"\" { return fmt.Errorf(\"new remote URL is required\") }","typeGuard":"func validRemoteURL(url string) bool { return strings.TrimSpace(url) != \"\" }","tryCatchPattern":null,"preventionTips":["Skip updates with empty URLs rather than passing zero values.","Provision CI secrets for the remote URL before update steps.","Diff config against current remotes to avoid empty-field regressions."],"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"}