{"record":{"id":"7a8cdd1b17651d47","repo":"windmill-labs/windmill","slug":"failed-to-clone-git-repo-e","errorCode":null,"errorMessage":"Failed to clone git repo `{}`: {e}","messagePattern":"Failed to clone git repo `(.+?)`: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/windmill-worker/src/ansible_executor.rs","lineNumber":1790,"sourceCode":"                )\n                .await?;\n            } else if let Some(commit) = interpolated_commit.as_ref() {\n                clone_repo_without_history(\n                    &repo,\n                    commit,\n                    job_dir,\n                    &job.id,\n                    worker_name,\n                    conn,\n                    mem_peak,\n                    canceled_by,\n                    &job.workspace_id,\n                    occupancy_metrics,\n                    git_ssh_cmd,\n                )\n                .await\n                .map_err(|e| {\n                    anyhow!(\n                        \"Failed to clone git repo `{}`: {e}\",\n                        sanitize_git_url(&repo.url)\n                    )\n                })?;\n            } else {\n                clone_repo(\n                    &repo,\n                    job_dir,\n                    &job.id,\n                    worker_name,\n                    conn,\n                    mem_peak,\n                    canceled_by,\n                    &job.workspace_id,\n                    occupancy_metrics,\n                    git_ssh_cmd,\n                )\n                .await","sourceCodeStart":1772,"sourceCodeEnd":1808,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/windmill-worker/src/ansible_executor.rs#L1772-L1808","documentation":"When cloning an ansible job's git-repo dependency fails, handle_ansible_job wraps the underlying error and re-raises it with the sanitized (credential-stripped) repo URL. The inner error `e` carries the actual git failure (auth, network, ref not found).","triggerScenarios":"get_repo (or clone path with git_ssh_cmd) invoked for a dependency repo returns Err — bad credentials, unknown revision/branch, unreachable host — during handle_ansible_job's dependency setup.","commonSituations":"Expired PAT or GitHub App token; SSH deploy key missing on worker or not in known_hosts; branch/commit pinned in the job no longer exists; private repo with no egress or proxy misconfig.","solutions":["Inspect the wrapped inner error (`: {e}` part) for the precise git failure.","Verify/renew the credentials on the git_repository resource (token or SSH key).","Confirm the pinned branch/commit still exists on the remote.","Test the clone manually from the worker with the same GIT_SSH_CMD.","Check worker egress/proxy and known_hosts configuration for private hosts."],"exampleFix":"// workspace git credentials: rotate token\n// before\nGIT_TOKEN=ghp_expired...\n// after\nGIT_TOKEN=ghp_newlyGeneratedToken  // then update the git_repository resource to use fresh credentials","handlingStrategy":"retry","validationCode":"// preflight clone reachability before running the job:\ngit ls-remote \"$REPO_URL\" \"$BRANCH\" >/dev/null 2>&1 && echo OK || echo 'repo/branch not clonable with current credentials'","typeGuard":null,"tryCatchPattern":"match clone_repo_with_ssh_cmd(...).await {\n    Ok(()) => {},\n    Err(e) => {\n      log::error!(\"Failed to clone git repo `{}`: {e:#}\", sanitize_git_url(&repo.url));\n      // retry with backoff for transient network errors; surface auth errors to the user\n    }\n}","preventionTips":["Rotate credentials before expiry and test them with ls-remote","Keep deploy keys and known_hosts current in worker images","Avoid pinning branches/commits that may be force-pushed away","Confirm worker egress allows the git host before deploying jobs"],"tags":["git","clone","authentication","network"],"backgroundTag":"git-clone-failed","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}