windmill-labs/windmill · error
Failed to clone git repo `{}`: {e}
Error message
Failed to clone git repo `{}`: {e} What it means
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).
Source
Thrown at backend/windmill-worker/src/ansible_executor.rs:1790
)
.await?;
} else if let Some(commit) = interpolated_commit.as_ref() {
clone_repo_without_history(
&repo,
commit,
job_dir,
&job.id,
worker_name,
conn,
mem_peak,
canceled_by,
&job.workspace_id,
occupancy_metrics,
git_ssh_cmd,
)
.await
.map_err(|e| {
anyhow!(
"Failed to clone git repo `{}`: {e}",
sanitize_git_url(&repo.url)
)
})?;
} else {
clone_repo(
&repo,
job_dir,
&job.id,
worker_name,
conn,
mem_peak,
canceled_by,
&job.workspace_id,
occupancy_metrics,
git_ssh_cmd,
)
.awaitView on GitHub (pinned to e474e8803c)
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.
Example fix
// workspace git credentials: rotate token // before GIT_TOKEN=ghp_expired... // after GIT_TOKEN=ghp_newlyGeneratedToken // then update the git_repository resource to use fresh credentials
Defensive patterns
Strategy: retry
Validate before calling
// preflight clone reachability before running the job: git ls-remote "$REPO_URL" "$BRANCH" >/dev/null 2>&1 && echo OK || echo 'repo/branch not clonable with current credentials'
Try / catch
match clone_repo_with_ssh_cmd(...).await {
Ok(()) => {},
Err(e) => {
log::error!("Failed to clone git repo `{}`: {e:#}", sanitize_git_url(&repo.url));
// retry with backoff for transient network errors; surface auth errors to the user
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Failed to fetch models for provider ${provider}
- Could not get commit hash for repository
- connection error: ${err instanceof Error ? err.message : err
- Could not check backend for git-sync settings: ${(error as E
- Could not fetch datatable schemas: ${err.message}
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/7a8cdd1b17651d47.
Report an issue: GitHub.