gastownhall/beads · error

dolt clone failed: %w Output: %s Cleaned up failed clone tar

Error message

dolt clone failed: %w
Output: %s
Cleaned up failed clone target %q; fix the clone error above and retry `bd bootstrap`

What it means

This is the success-cleanup branch of formatFailedCloneTargetError: `dolt clone` failed, the target did not pre-exist, and removeFailedCloneTargetWithRetry successfully deleted the partial clone. The error reports the underlying dolt failure and its output, and tells you the directory was cleaned so a plain retry after fixing the cause is safe.

Source

Thrown at internal/storage/dolt/bootstrap.go:136

	if !info.IsDir() || info.Mode()&os.ModeSymlink != 0 {
		return false, nil
	}

	for attempt := 0; ; attempt++ {
		err := os.RemoveAll(path)
		if err == nil || os.IsNotExist(err) {
			return true, nil
		}
		if attempt >= len(failedCloneCleanupRetryDelays) {
			return true, err
		}
		time.Sleep(failedCloneCleanupRetryDelays[attempt])
	}
}

func formatFailedCloneTargetError(cloneErr error, output []byte, cloneTarget string, cleaned bool, cleanupErr error) error {
	if cleanupErr == nil && cleaned {
		return fmt.Errorf("dolt clone failed: %w\nOutput: %s\nCleaned up failed clone target %q; fix the clone error above and retry `bd bootstrap`", cloneErr, output, cloneTarget)
	}
	if cleanupErr == nil {
		return fmt.Errorf("dolt clone failed: %w\nOutput: %s", cloneErr, output)
	}
	if !cleaned {
		return fmt.Errorf("dolt clone failed: %w\nOutput: %s\nCould not inspect failed clone target %q before cleanup: %v\nOn Windows this usually means a dolt or bd process, or antivirus scanner, still has a file handle open under `.dolt/noms/LOCK`. Stop stuck dolt/bd processes, wait a moment, delete the directory manually if it remains, then retry `bd bootstrap`", cloneErr, output, cloneTarget, cleanupErr)
	}
	return fmt.Errorf("dolt clone failed: %w\nOutput: %s\nCould not clean up failed clone target %q after retrying: %v\nOn Windows this usually means a dolt or bd process, or antivirus scanner, still has a file handle open under `.dolt/noms/LOCK`. Stop stuck dolt/bd processes, wait a moment, delete the directory manually if it remains, then retry `bd bootstrap`", cloneErr, output, cloneTarget, cleanupErr)
}

func doltCloneArgs(remoteURL, target string) []string {
	args := []string{"clone"}
	if user := os.Getenv("DOLT_REMOTE_USER"); user != "" {
		args = append(args, "--user", user)
	}
	return append(args, remoteURL, target)
}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Read the Output section for dolt's actual failure message and fix that root cause (URL typo, missing auth, network).
  2. For private DoltHub repos, run `dolt login` / set DOLT_REMOTE_USER so clone can authenticate.
  3. Verify connectivity to the remote host (`curl -I <url>` or `git ls-remote` for git remotes) and check VPN/proxy settings.
  4. Retry `bd bootstrap` after fixing — the failed target was already cleaned up, so no manual deletion is needed.

Example fix

# before
sync:
  remote: https://doltremoteapi.dolthub.com/wrong-org/wrong-repo
# after: correct the remote, then retry (cleanup already handled)
sync:
  remote: https://doltremoteapi.dolthub.com/my-org/my-repo
$ bd bootstrap
Defensive patterns

Strategy: retry

Validate before calling

if err := remotecache.ValidateRemoteURL(remoteURL); err != nil { /* fix before attempting */ }
if _, err := exec.LookPath("dolt"); err != nil { /* install dolt first */ }

Try / catch

ok, err := dolt.BootstrapFromRemote(ctx, doltDir, remote)
if err != nil && strings.Contains(err.Error(), "Cleaned up failed clone target") {
    // target already removed; safe to just retry after fixing the clone cause
}

Prevention

When it happens

Trigger: BootstrapFromRemoteWithDB's `dolt clone` exits non-zero into formatFailedCloneTargetError with cleaned=true, cleanupErr=nil — any dolt clone failure (bad URL, auth, network, unsupported remote) on a fresh target that was then removed.

Common situations: Wrong or unreachable remote URL; DoltHub repo is private and credentials are missing; no network/VPN in CI; remote database name typo; transient network drop mid-clone.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/afc1cc809225df67. Report an issue: GitHub.