{"record":{"id":"c6a948af1adc0166","repo":"astral-sh/ruff","slug":"git-clone-failed","errorCode":null,"errorMessage":"Git clone failed: {}","messagePattern":"Git clone failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/ruff_benchmark/src/real_world_projects.rs","lineNumber":218,"sourceCode":"fn clone_repository(repo_url: &str, target_dir: &Path, commit: &str) -> Result<()> {\n    // Create parent directory if it doesn't exist\n    if let Some(parent) = target_dir.parent() {\n        std::fs::create_dir_all(parent).context(\"Failed to create parent directory for clone\")?;\n    }\n\n    // Clone with minimal depth and fetch only the specific commit\n    let output = Command::new(\"git\")\n        .args([\n            \"clone\",\n            \"--filter=blob:none\", // Don't download large files initially\n            \"--no-checkout\",      // Don't checkout files yet\n            repo_url,\n            target_dir.to_str().unwrap(),\n        ])\n        .output()\n        .context(\"Failed to execute git clone command\")?;\n\n    anyhow::ensure!(\n        output.status.success(),\n        \"Git clone failed: {}\",\n        String::from_utf8_lossy(&output.stderr)\n    );\n\n    // Fetch the specific commit\n    let output = Command::new(\"git\")\n        .args([\"fetch\", \"origin\", commit])\n        .current_dir(target_dir)\n        .output()\n        .context(\"Failed to execute git fetch command\")?;\n\n    anyhow::ensure!(\n        output.status.success(),\n        \"Git fetch of commit {} failed: {}\",\n        commit,\n        String::from_utf8_lossy(&output.stderr)\n    );","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/astral-sh/ruff/blob/672bb4edf04c84f8b0753346359daee4057158f2/crates/ruff_benchmark/src/real_world_projects.rs#L200-L236","documentation":"The benchmark harness clones real-world projects on first use (blob-filtered, no checkout); if `git clone` exits nonzero this error is raised with git's stderr.","triggerScenarios":"First `cargo bench` run of a real-world project when cloning fails: network unreachable, proxy blocking https git, repository moved or made private, or insufficient disk space.","commonSituations":"Air-gapped or proxied CI environments; disk pressure under target/; upstream repos relocated since the benchmark table was written.","solutions":["Read the embedded git stderr to identify network vs repository vs disk failure","Verify the repo URL is reachable: `git ls-remote <repo_url> HEAD`","Free disk space under target/ if the clone ran out of room, then rerun","Retry after transient network failures; the clone is retried on the next run"],"exampleFix":"# before\n bench run fails with: Git clone failed: fatal: unable to access ...\n\n# after\ngit ls-remote <repo_url> HEAD && cargo bench --bench <real-world-bench>","handlingStrategy":"retry","validationCode":"git ls-remote \"$repo_url\" HEAD >/dev/null 2>&1 || {\n  echo \"cannot reach $repo_url — check network/proxy\" >&2\n  exit 1\n}\ndf -h target | tail -1 # ensure headroom before a multi-repo clone","typeGuard":null,"tryCatchPattern":"for i in 1 2 3; do\n  cargo bench --bench \"$bench\" && break\n  echo \"clone attempt $i failed; retrying\" >&2\n  rm -rf \"target/benchmark_cache/$project\"\n  sleep 5\ndone","preventionTips":["Pre-clone benchmark repos in a warm-up CI step with retries","Keep target/ on a volume with free space for several filtered clones","Verify repo URLs still resolve when updating the benchmark suite"],"tags":["benchmark","git","network"],"backgroundTag":null,"analyzedSha":"672bb4edf04c84f8b0753346359daee4057158f2","analyzedAt":"2026-08-16T08:54:05.464Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}