{"record":{"id":"597648d96c30a3de","repo":"gastownhall/beads","slug":"w-output-s","errorCode":null,"errorMessage":"%w\nOutput: %s","messagePattern":"%w\nOutput: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/remotecache/cache.go","lineNumber":195,"sourceCode":"\n// Evict removes a cached remote clone entirely.\nfunc (c *Cache) Evict(remoteURL string) error {\n\tentry := c.entryDir(remoteURL)\n\treturn os.RemoveAll(entry)\n}\n\n// doltExists checks if a dolt database exists at the given path.\nfunc (c *Cache) doltExists(dbPath string) bool {\n\tdoltDir := filepath.Join(dbPath, \".dolt\")\n\tinfo, err := os.Stat(doltDir)\n\treturn err == nil && info.IsDir()\n}\n\n// doltClone clones a remote into the target directory.\nfunc (c *Cache) doltClone(ctx context.Context, remoteURL, target string) error {\n\tcmd := doltCmd(ctx, \"\", doltCloneArgs(remoteURL, target)...)\n\tif output, err := cmd.CombinedOutput(); err != nil {\n\t\treturn fmt.Errorf(\"%w\\nOutput: %s\", err, output)\n\t}\n\treturn nil\n}\n\n// doltCmd builds a dolt CLI invocation for cache transfers with git tracing\n// scrubbed (internal/gittraceenv) and templated hooks disabled (GH#4272).\n// dir \"\" runs in the process working directory.\nfunc doltCmd(ctx context.Context, dir string, args ...string) *exec.Cmd {\n\tcmd := exec.CommandContext(ctx, \"dolt\", args...) // #nosec G204 -- fixed command with validated remote/ref args\n\tcmd.Dir = dir\n\tcmd.Env = githooksenv.DisabledEnv(gittraceenv.ScrubEnv(os.Environ()))\n\treturn cmd\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)","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/remotecache/cache.go#L177-L213","documentation":"doltClone() runs `dolt clone <remoteURL> <target>` and, on non-zero exit, returns the exec error wrapped together with dolt's combined stdout/stderr. This is the cold-start path of Ensure(): the remote could not be cloned into the local cache. The embedded Output text contains dolt's actual reason.","triggerScenarios":"Cache.Ensure() on a machine with no cached clone invokes doltClone; dolt exits non-zero because the remote URL is wrong/unreachable, authentication is missing (DOLT_REMOTE_USER/DOLT_REMOTE_PASSWORD/dolt creds), the target path is unwritable, or the dolt CLI version is incompatible with the remote.","commonSituations":"First sync on a new machine; typos or unsupported schemes in the remote URL; corporate proxy/firewall blocking Dolthub; expired credentials; full disk or permission-denied cache dir; remote repo deleted or made private.","solutions":["Read the wrapped `Output:` lines — dolt's message names the real cause (auth, DNS, not found).","Validate the URL: it must pass remotecache.ValidateRemoteURL (e.g. dolthub://org/repo, https://...).","Set credentials: DOLT_REMOTE_USER/DOLT_REMOTE_PASSWORD env vars or `dolt creds use`.","Confirm network reachability and proxy settings; test `dolt clone <url> /tmp/test` manually.","Free disk space / fix permissions on the cache dir; if the target exists but is broken, Evict() then retry."],"exampleFix":"// before: passing a bare repo name without scheme\n_, err := cache.Ensure(ctx, \"myorg/myrepo\")\n// after: fully qualified URL\n_, err := cache.Ensure(ctx, \"dolthub://myorg/myrepo\")","handlingStrategy":"try-catch","validationCode":"if err := remotecache.ValidateRemoteURL(remoteURL); err != nil {\n    return fmt.Errorf(\"bad remote URL %q: %w\", remoteURL, err)\n}\nif _, err := exec.LookPath(\"dolt\"); err != nil {\n    return fmt.Errorf(\"dolt CLI not installed\")\n}\nif os.Getenv(\"DOLT_REMOTE_USER\") == \"\" {\n    fmt.Fprintln(os.Stderr, \"warning: DOLT_REMOTE_USER unset; private remotes will fail to clone\")\n}","typeGuard":null,"tryCatchPattern":"if _, err := cache.Ensure(ctx, url); err != nil {\n    if strings.Contains(err.Error(), \"dolt clone failed\") {\n        // surface dolt's own output to the operator\n        return fmt.Errorf(\"cannot reach or authenticate to %s: %w\", url, err)\n    }\n    return err\n}","preventionTips":["Use fully-qualified, scheme-correct remote URLs (dolthub://org/repo).","Pre-provision credentials (DOLT_REMOTE_USER/DOLT_REMOTE_PASSWORD or dolt creds) before first sync.","Test `dolt clone <url>` manually on new machines to validate network/creds.","Check disk space and cache-dir writability before cold-start clones."],"tags":["go","dolt","clone","network","authentication"],"backgroundTag":"dolt-clone-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}