{"record":{"id":"dd7b3e973de3ab92","repo":"windmill-labs/windmill","slug":"the-head-commit-hash-was-not-found-for-repo","errorCode":null,"errorMessage":"The HEAD commit hash was not found for repo `{}`","messagePattern":"The HEAD commit hash was not found for repo `(.+?)`","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/windmill-worker/src/ansible_executor.rs","lineNumber":1186,"sourceCode":"\n    let output = git_cmd.stderr(Stdio::piped()).output().await?;\n\n    if !output.status.success() {\n        let stderr = String::from_utf8(output.stderr)?;\n        return Err(anyhow!(\"Error getting git repo commit hash: {stderr}\"));\n    }\n\n    let stdout = String::from_utf8(output.stdout)?;\n\n    let lines: Vec<&str> = stdout.lines().collect();\n\n    if lines.len() != 1 {\n        return Err(anyhow!(\"Unexpected output format for git ls-remote\",));\n    }\n\n    Ok(lines\n        .first()\n        .ok_or(anyhow!(\n            \"The HEAD commit hash was not found for repo `{}`\",\n            sanitize_git_url(&repo.url)\n        ))?\n        .split_whitespace()\n        .next()\n        .map(|s| s.to_string())\n        .ok_or(anyhow!(\"Unexpected output format for git ls-remote\"))?)\n}\n\npub async fn get_git_repos_lock(\n    repos: &Vec<GitRepo>,\n    job_dir: &str,\n    job_id: &Uuid,\n    worker_name: &str,\n    conn: &Connection,\n    mem_peak: &mut i32,\n    canceled_by: &mut Option<CanceledBy>,\n    w_id: &str,","sourceCodeStart":1168,"sourceCodeEnd":1204,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/windmill-worker/src/ansible_executor.rs#L1168-L1204","documentation":"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.","triggerScenarios":"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.","commonSituations":"Proxied or shimmed git remotes returning a degenerate line; corrupted git configuration altering output; extremely old/unusual git servers.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"line=$(git ls-remote \"$REPO_URL\" HEAD | head -n1)\necho \"$line\" | awk '{exit ($1 ~ /^[0-9a-f]{40}$/) ? 0 : 1}' && echo OK || echo 'no valid hash in output'","typeGuard":"fn is_commit_hash(s: &str) -> bool { !s.is_empty() && s.chars().all(|c| c.is_ascii_hexdigit()) && s.len() >= 7 }","tryCatchPattern":null,"preventionTips":["Point resources at canonical repository URLs (no proxy shims)","Keep worker git up to date","Pin explicit commits for critical dependencies"],"tags":["git","output-parsing"],"backgroundTag":"git-head-unresolvable","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}