gastownhall/beads · error
create remote origin: %w
Error message
create remote origin: %w
What it means
After confirming no remote named 'origin' exists, bd creates it pointing at remoteURL. This wrapper fires when DoltRemoteUseCase().CreateRemote(ctx, "origin", remoteURL) fails during proxied-server init. Note origin is created unconditionally here (existence already checked), so the cause is usually storage, connectivity, or an invalid remote URL.
Source
Thrown at cmd/bd/init_proxied_server.go:403
return "bd init", nil
})
}
// configureProxiedInitDoltRemote adds the sync remote, skipping a name that is
// already taken.
func configureProxiedInitDoltRemote(ctx context.Context, provider uow.UnitOfWorkProvider, remoteURL string) error {
return uow.RunTx(ctx, provider, func(ctx context.Context, uw uow.UnitOfWork) (string, error) {
remotes, err := uw.DoltRemoteUseCase().ListRemotes(ctx)
if err != nil {
return "", fmt.Errorf("list remotes: %w", err)
}
for _, r := range remotes {
if r.Name == "origin" {
return "", nil
}
}
if err := uw.DoltRemoteUseCase().CreateRemote(ctx, "origin", remoteURL); err != nil {
return "", fmt.Errorf("create remote origin: %w", err)
}
return "", nil
})
}
// adoptTeamServerIdentity reads the bts-provisioned identity out of the shared
// database, following the gateway contract: adopt if present, hard error if
// absent — bd never writes identity in team-server mode.
//
// ABSENT means "unprovisioned, tell them to run bts init" and UNREADABLE means
// "the connection failed, say so"; keeping those apart is the InitVerifier
// role's promise. The two markers arrive as ONE snapshot, so the prefix and the
// project id cannot come from either side of a concurrent write.
func adoptTeamServerIdentity(ctx context.Context, verifier issueops.InitVerifier, dbName, localPrefix string, prefixIsExplicit bool, localProjectID string) (prefix, projectID string, err error) {
identity, readErr := verifier.VerifyIdentity(ctx, issueops.VerifyIdentityRequest{})
if _, err := resolveInitIssuePrefix(true, identity.Prefix, dbName, localPrefix, readErr); err != nil {
if readErr == nil {
return "", "", fmt.Errorf(View on GitHub (pinned to 71377f2769)
Solutions
- Validate the remote URL supplied to bd init is a well-formed Dolt/Git remote
- Re-run bd init — the existence check makes it idempotent if origin now exists
- Serialize concurrent init runs; the second run will skip creation
- Check the wrapped driver error for table/permission issues
Example fix
// before err: "create remote origin: invalid remote url" // after bd init --remote https://doltremoteapi.dolthub.com/org/correct-repo
Defensive patterns
Strategy: validation
Validate before calling
u, err := url.Parse(remoteURL)
if err != nil || u.Scheme == "" || u.Host == "" {
return fmt.Errorf("remote URL %q must be an absolute https/ssh URL", remoteURL)
} Try / catch
if err != nil && strings.Contains(err.Error(), "create remote origin:") {
// idempotent path: re-running init skips creation if origin now exists
log.Printf("remote creation failed: %v", errors.Unwrap(err))
} Prevention
- Pass a well-formed absolute Dolt remote URL to init
- Avoid concurrent bd init runs against the same database — origin creation races
- Re-run init safely: existing 'origin' is detected and skipped
- Verify write permissions on the remotes table
When it happens
Trigger: bd init in team-server mode where creating the 'origin' remote fails — bad remote URL, remote table write failure, server connection drop between ListRemotes and CreateRemote, or a race where another init created origin concurrently.
Common situations: Malformed remoteURL passed to init; concurrent bd init runs both passing the existence check; permissions lacking on the remotes table.
Related errors
- list remotes: %w
- record repo_id: %w
- record clone_id: %w
- record last_import_time: %w
- list existing remotes: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/ecc1cae01d014d4e.
Report an issue: GitHub.