{"record":{"id":"ba14d92464914388","repo":"go-task/task","slug":"failed-to-clone-repository-w","errorCode":null,"errorMessage":"failed to clone repository: %w","messagePattern":"failed to clone repository: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"taskfile/node_git.go","lineNumber":155,"sourceCode":"\t}\n\n\t// Only check context if we need to clone (requires network)\n\tif err := ctx.Err(); err != nil {\n\t\treturn \"\", fmt.Errorf(\"context cancelled while waiting for repository lock: %w\", err)\n\t}\n\n\tgetterURL := node.buildURL()\n\n\tclient := &getter.Client{\n\t\tCtx:  ctx,\n\t\tSrc:  getterURL,\n\t\tDst:  cacheDir,\n\t\tMode: getter.ClientModeDir,\n\t}\n\n\tif err := client.Get(); err != nil {\n\t\t_ = os.RemoveAll(cacheDir)\n\t\treturn \"\", fmt.Errorf(\"failed to clone repository: %w\", err)\n\t}\n\n\treturn cacheDir, nil\n}\n\nfunc (node *GitNode) ReadContext(ctx context.Context) ([]byte, error) {\n\t// Get or clone the repository into cache\n\trepoDir, err := node.getOrCloneRepo(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Build path to Taskfile in the cached repo\n\t// If node.path is empty, search in repo root; otherwise search in the specified path\n\t// fsext.SearchPath handles both files and directories (searching for DefaultTaskfiles)\n\tsearchPath := repoDir\n\tif node.path != \"\" {\n\t\tsearchPath = filepath.Join(repoDir, node.path)","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/go-task/task/blob/385e5ad92af02877b6d7cf9dcc963b5ed916e70a/taskfile/node_git.go#L137-L173","documentation":"getOrCloneRepo clones a remote git Taskfile via getter.Client.Get(). On any clone failure (auth, network, bad URL, missing repo), the cache directory is removed and the getter error is wrapped with this message.","triggerScenarios":"ReadContext -> getOrCloneRepo: client.Get() returns an error while cloning the repository into cacheDir — unreachable host, private repo without credentials, nonexistent ref/repo, or TLS problems.","commonSituations":"Cloning a private Taskfile repo without SSH keys or tokens; typo in the include URL; corporate proxy/firewall blocking git over HTTPS; referencing a branch or tag that does not exist.","solutions":["Verify the include URL is correct and the repo/branch exists (git clone <url> manually)","Set up credentials: SSH keys for git@ URLs or a token for private HTTPS repos","Check network/proxy/VPN connectivity to the git host","Inspect the wrapped cause for the underlying git/getter error; retry after fixing"],"exampleFix":"# before (includes in Taskfile)\nincludes:\n  - ops: https://git.example.com/team/ops-taskfile.git@main\n# after (corrected URL / existing ref)\nincludes:\n  - ops: https://git.example.com/team/taskfiles.git@main","handlingStrategy":"retry","validationCode":"u, err := url.Parse(includeURL)\nif err != nil {\n    return err\n}\nconn, err := net.DialTimeout(\"tcp\", net.JoinHostPort(u.Host, \"443\"), 5*time.Second)\nif err != nil {\n    return fmt.Errorf(\"cannot reach git host %s: %w\", u.Host, err)\n}\nconn.Close()","typeGuard":"func isReachableGitURL(raw string) bool {\n    u, err := url.Parse(raw)\n    if err != nil || u.Host == \"\" {\n        return false\n    }\n    c, err := net.DialTimeout(\"tcp\", u.Host+\":443\", 3*time.Second)\n    if err != nil {\n        return false\n    }\n    c.Close()\n    return true\n}","tryCatchPattern":"data, err := node.ReadContext(ctx)\nif err != nil {\n    if strings.Contains(err.Error(), \"failed to clone repository\") {\n        // check credentials/network, maybe retry with backoff\n    }\n    return err\n}","preventionTips":["Verify include URLs and refs exist before committing them","Configure SSH keys or credential helpers for private repos","Warm the git node cache before offline/CI runs","Test the URL with a manual `git clone` first"],"tags":["git","network","clone","remote-taskfile","authentication"],"backgroundTag":"git-clone-failed","analyzedSha":"385e5ad92af02877b6d7cf9dcc963b5ed916e70a","analyzedAt":"2026-09-05T09:01:05.226Z","contentChangedAt":"2026-09-05T09:01:05.226Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}