gastownhall/beads · error
record clone_id: %w
Error message
record clone_id: %w
What it means
Same seeding transaction as repo_id: this wrapper fires when cfg.SetMetadata(ctx, "clone_id", cloneID) fails while recording the clone fingerprint during proxied-server init. It identifies the failing metadata key; the wrapped underlying error carries the actual cause.
Source
Thrown at cmd/bd/init_proxied_server.go:376
//
// It is separate from the identity because its LIFETIME is: the identity is
// written once and then adopted forever, while these four describe the clone
// running init and are refreshed every time it runs. In the refusable one-time
// write, a re-init on a shared database would silently stop recording them.
func recordProxiedInitTrackingState(ctx context.Context, provider uow.UnitOfWorkProvider, repoID, cloneID string) error {
return uow.RunTx(ctx, provider, func(ctx context.Context, uw uow.UnitOfWork) (string, error) {
cfg := uw.ConfigUseCase()
// An absent fingerprint is recorded as nothing rather than as "": an
// empty row reads back to cross-project verification as a clone whose
// fingerprint failed to compute.
if repoID != "" {
if err := cfg.SetMetadata(ctx, "repo_id", repoID); err != nil {
return "", fmt.Errorf("record repo_id: %w", err)
}
}
if cloneID != "" {
if err := cfg.SetMetadata(ctx, "clone_id", cloneID); err != nil {
return "", fmt.Errorf("record clone_id: %w", err)
}
}
if err := cfg.SetMetadata(ctx, "last_import_time", time.Now().UTC().Format(time.RFC3339)); err != nil {
return "", fmt.Errorf("record last_import_time: %w", err)
}
if err := cfg.SetLocalMetadata(ctx, workapi.MetadataKeyVersion, Version); err != nil {
return "", fmt.Errorf("record bd_version: %w", err)
}
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 {View on GitHub (pinned to 71377f2769)
Solutions
- Retry bd init after confirming the team server is healthy
- Check for concurrent init runs against the same database and serialize them
- Verify write permissions for the connecting user on the metadata table
- Read the wrapped underlying error for the driver-level cause
Example fix
// before err: "record clone_id: database is locked" // after: avoid concurrent inits on the same shared db; retry bd init # run only one init per clone at a time
Defensive patterns
Strategy: retry
Validate before calling
// ensure only one init runs per database at a time
if !acquireInitLock(sharedDBName) {
return errors.New("another init is in progress for this database")
} Try / catch
if err != nil && strings.Contains(err.Error(), "record clone_id:") {
log.Printf("clone_id write failed: %v", errors.Unwrap(err))
// serialize concurrent inits, then retry bd init
} Prevention
- Serialize bd init runs against the same shared database
- Point at the writable primary, not a read-only replica
- Keep the team server healthy across the whole init run
- Inspect the wrapped cause for lock/permission specifics
When it happens
Trigger: bd init in team-server mode with a non-empty cloneID where SetMetadata for clone_id fails — storage unavailable, transaction conflict, or permission denied on the shared database.
Common situations: Shared Dolt server restarted mid-init; concurrent init of two clones against the same database causing a transaction conflict; read-only replica pointed at instead of the writable primary.
Related errors
- record repo_id: %w
- record last_import_time: %w
- record bd_version: %w
- list remotes: %w
- create remote origin: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/4de09ab8965fc7af.
Report an issue: GitHub.