{"record":{"id":"afc1cc809225df67","repo":"gastownhall/beads","slug":"dolt-clone-failed-w-output-s-cleaned-up-failed","errorCode":null,"errorMessage":"dolt clone failed: %w\nOutput: %s\nCleaned up failed clone target %q; fix the clone error above and retry `bd bootstrap`","messagePattern":"dolt clone failed: %w\nOutput: (.+?)\nCleaned up failed clone target %q; fix the clone error above and retry `bd bootstrap`","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/dolt/bootstrap.go","lineNumber":136,"sourceCode":"\tif !info.IsDir() || info.Mode()&os.ModeSymlink != 0 {\n\t\treturn false, nil\n\t}\n\n\tfor attempt := 0; ; attempt++ {\n\t\terr := os.RemoveAll(path)\n\t\tif err == nil || os.IsNotExist(err) {\n\t\t\treturn true, nil\n\t\t}\n\t\tif attempt >= len(failedCloneCleanupRetryDelays) {\n\t\t\treturn true, err\n\t\t}\n\t\ttime.Sleep(failedCloneCleanupRetryDelays[attempt])\n\t}\n}\n\nfunc formatFailedCloneTargetError(cloneErr error, output []byte, cloneTarget string, cleaned bool, cleanupErr error) error {\n\tif cleanupErr == nil && cleaned {\n\t\treturn 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)\n\t}\n\tif cleanupErr == nil {\n\t\treturn fmt.Errorf(\"dolt clone failed: %w\\nOutput: %s\", cloneErr, output)\n\t}\n\tif !cleaned {\n\t\treturn 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)\n\t}\n\treturn 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)\n}\n\nfunc doltCloneArgs(remoteURL, target string) []string {\n\targs := []string{\"clone\"}\n\tif user := os.Getenv(\"DOLT_REMOTE_USER\"); user != \"\" {\n\t\targs = append(args, \"--user\", user)\n\t}\n\treturn append(args, remoteURL, target)\n}\n","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/dolt/bootstrap.go#L118-L154","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the Output section for dolt's actual failure message and fix that root cause (URL typo, missing auth, network).","For private DoltHub repos, run `dolt login` / set DOLT_REMOTE_USER so clone can authenticate.","Verify connectivity to the remote host (`curl -I <url>` or `git ls-remote` for git remotes) and check VPN/proxy settings.","Retry `bd bootstrap` after fixing — the failed target was already cleaned up, so no manual deletion is needed."],"exampleFix":"# before\nsync:\n  remote: https://doltremoteapi.dolthub.com/wrong-org/wrong-repo\n# after: correct the remote, then retry (cleanup already handled)\nsync:\n  remote: https://doltremoteapi.dolthub.com/my-org/my-repo\n$ bd bootstrap","handlingStrategy":"retry","validationCode":"if err := remotecache.ValidateRemoteURL(remoteURL); err != nil { /* fix before attempting */ }\nif _, err := exec.LookPath(\"dolt\"); err != nil { /* install dolt first */ }","typeGuard":null,"tryCatchPattern":"ok, err := dolt.BootstrapFromRemote(ctx, doltDir, remote)\nif err != nil && strings.Contains(err.Error(), \"Cleaned up failed clone target\") {\n    // target already removed; safe to just retry after fixing the clone cause\n}","preventionTips":["Pre-validate the remote URL and credentials before invoking bootstrap.","Check dolt's Output in the error for the root cause; it is included verbatim.","For CI, warm the network/credentials before the first clone (e.g. dolt login in setup)."],"tags":["dolt","clone","network","bootstrap"],"backgroundTag":"clone-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}