{"record":{"id":"f5de46b8289edd0d","repo":"gastownhall/beads","slug":"createremote-url-must-not-be-empty","errorCode":null,"errorMessage":"CreateRemote: url must not be empty","messagePattern":"CreateRemote: url must not be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/domain/remote.go","lineNumber":41,"sourceCode":"\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\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","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/domain/remote.go#L23-L59","documentation":"Argument-validation error from the Dolt remote use-case (CreateRemote in internal/storage/domain/remote.go) thrown when the remote URL is an empty string. A remote needs a URL to point at; the check runs before remoteRepo.AddRemote.","triggerScenarios":"Calling CreateRemote(ctx, name, \"\") — e.g., bd remote add origin with no URL argument, or an empty $URL variable in scripts.","commonSituations":"Copy-paste dropping the URL; environment variables for the remote host not set in CI; config templates with a placeholder URL never substituted.","solutions":["Pass a full remote URL, e.g. bd remote add origin https://github.com/org/repo.git.","In scripts, assert the URL variable is non-empty before invoking.","Verify CI env provisioning for the repository URL variable."],"exampleFix":"// before\nurl := os.Getenv(\"REMOTE_URL\") // may be \"\"\nuc.CreateRemote(ctx, name, url)\n// after\nif url == \"\" { return fmt.Errorf(\"REMOTE_URL is not set\") }\nuc.CreateRemote(ctx, name, url)","handlingStrategy":"validation","validationCode":"if url == \"\" { return fmt.Errorf(\"remote URL is required\") }","typeGuard":"func validRemoteURL(url string) bool { return strings.HasPrefix(url, \"https://\") || strings.HasPrefix(url, \"git@\") || strings.HasPrefix(url, \"file://\") }","tryCatchPattern":null,"preventionTips":["Use ${URL:?msg} in scripts to catch unset URL variables.","Substitute config template placeholders in CI before use.","Sanity-check the URL scheme before calling CreateRemote."],"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"}