{"record":{"id":"13566d77b200d324","repo":"moghtech/komodo","slug":"failed-git-is-not-installed-or-available-on-pa","errorCode":null,"errorMessage":"Failed: 'git' is not installed or available on $PATH","messagePattern":"Failed: 'git' is not installed or available on \\$PATH","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"lib/git/src/installed.rs","lineNumber":17,"sourceCode":"use std::time::Duration;\n\nuse anyhow::anyhow;\nuse command::{CommandOptions, run_standard_command};\n\n/// Returns error if git not installed\npub async fn check_installed() -> anyhow::Result<()> {\n  if run_standard_command(\n    \"which git\",\n    CommandOptions::default().timeout(Duration::from_secs(2)),\n  )\n  .await\n  .success()\n  {\n    Ok(())\n  } else {\n    Err(anyhow!(\n      \"Failed: 'git' is not installed or available on $PATH\"\n    ))\n  }\n}\n","sourceCodeStart":1,"sourceCodeEnd":22,"githubUrl":"https://github.com/moghtech/komodo/blob/780ac68b992094a9fccd5fffb760e0c84fd3c3d1/lib/git/src/installed.rs#L1-L22","documentation":"This error is thrown by check_installed when a spawn of the 'git' binary does not exit successfully, meaning git is either not installed or not resolvable on the $PATH. Every git-backed operation (clone, commit, init, hash/remote lookups) calls check_installed first as a precondition guard, so any of those APIs will fail with this message when the toolchain is absent.","triggerScenarios":"Calling clone, commit_file_inner, commit_all, init_folder_as_repo, get_commit_hash_info, or get_remote_url on a machine where the git executable is not installed or is not on $PATH, so the spawned `git` command exits non-zero.","commonSituations":"Docker images or CI runners without git installed (e.g. slim/alpine base images); barebones server deploys where the agent binary runs as a different user with a minimal PATH; Windows environments where git was installed but not added to PATH.","solutions":["Install git on the host (apt-get install git / apk add git / brew install git / choco install git)","Verify the executable resolves: run `which git` (or `where git`) as the same user the library runs as","Fix the PATH of the process running the library so it includes the git binary directory","If the install happened while running, restart the process so the updated PATH is picked up"],"exampleFix":"// before (Dockerfile)\nFROM rust:slim\n// after (Dockerfile)\nFROM rust:slim\nRUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*","handlingStrategy":"validation","validationCode":"fn ensure_git_installed() -> anyhow::Result<()> {\n  let ok = std::process::Command::new(\"git\").arg(\"--version\").output()\n    .map(|o| o.status.success()).unwrap_or(false);\n  if ok { Ok(()) } else { Err(anyhow!(\"git is not available on $PATH\")) }\n}","typeGuard":"fn git_available() -> bool {\n  std::process::Command::new(\"git\").arg(\"--version\").output()\n    .map(|o| o.status.success()).unwrap_or(false)\n}","tryCatchPattern":"match repo.clone(url, path).await {\n  Err(e) if e.to_string().contains(\"not installed\") => eprintln!(\"Install git first: {}\", e),\n  Err(e) => return Err(e),\n  Ok(v) => v,\n}","preventionTips":["Bake git into deployment images (Dockerfile/AMI) before installing the app","Add a startup health check that verifies `git --version` before accepting work","Run the process with a PATH that includes the git binary for its service user"],"tags":["git","environment","dependency-missing","process-execution"],"backgroundTag":"command-not-found","analyzedSha":"780ac68b992094a9fccd5fffb760e0c84fd3c3d1","analyzedAt":"2026-09-08T10:02:44.861Z","contentChangedAt":"2026-09-08T10:02:44.861Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}