windmill-labs/windmill · error
The HEAD commit hash was not found for repo `{}`
Error message
The HEAD commit hash was not found for repo `{}` What it means
The single ls-remote line must contain the commit hash as its first whitespace-separated token. If the line exists but has no leading hash field, this error names the (sanitized) repo whose HEAD hash could not be extracted.
Source
Thrown at backend/windmill-worker/src/ansible_executor.rs:1186
let output = git_cmd.stderr(Stdio::piped()).output().await?;
if !output.status.success() {
let stderr = String::from_utf8(output.stderr)?;
return Err(anyhow!("Error getting git repo commit hash: {stderr}"));
}
let stdout = String::from_utf8(output.stdout)?;
let lines: Vec<&str> = stdout.lines().collect();
if lines.len() != 1 {
return Err(anyhow!("Unexpected output format for git ls-remote",));
}
Ok(lines
.first()
.ok_or(anyhow!(
"The HEAD commit hash was not found for repo `{}`",
sanitize_git_url(&repo.url)
))?
.split_whitespace()
.next()
.map(|s| s.to_string())
.ok_or(anyhow!("Unexpected output format for git ls-remote"))?)
}
pub async fn get_git_repos_lock(
repos: &Vec<GitRepo>,
job_dir: &str,
job_id: &Uuid,
worker_name: &str,
conn: &Connection,
mem_peak: &mut i32,
canceled_by: &mut Option<CanceledBy>,
w_id: &str,View on GitHub (pinned to e474e8803c)
Solutions
- Inspect the raw `git ls-remote <url> HEAD` output from the worker.
- Point the resource at the canonical repository URL (bypass proxies/shims).
- Update git on the worker if the remote protocol is legacy.
- Pin an explicit commit hash in the dependency instead of resolving HEAD.
Defensive patterns
Strategy: validation
Validate before calling
line=$(git ls-remote "$REPO_URL" HEAD | head -n1)
echo "$line" | awk '{exit ($1 ~ /^[0-9a-f]{40}$/) ? 0 : 1}' && echo OK || echo 'no valid hash in output' Type guard
fn is_commit_hash(s: &str) -> bool { !s.is_empty() && s.chars().all(|c| c.is_ascii_hexdigit()) && s.len() >= 7 } Prevention
- Point resources at canonical repository URLs (no proxy shims)
- Keep worker git up to date
- Pin explicit commits for critical dependencies
When it happens
Trigger: ls-remote returns exactly one line whose first token is empty/whitespace-only — practically a malformed or adversarial remote response for the configured repo URL.
Common situations: Proxied or shimmed git remotes returning a degenerate line; corrupted git configuration altering output; extremely old/unusual git servers.
Related errors
- Unexpected output format for git ls-remote
- You can only create forks within a git repo. Forks are track
- Could not get git branch name
- --from-branch is for converting a *different* working branch
- Refusing to rename your current branch \`${currentBranch}\`
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/dd7b3e973de3ab92.
Report an issue: GitHub.