moghtech/komodo · error · anyhow::Error
Failed: 'git' is not installed or available on $PATH
Error message
Failed: 'git' is not installed or available on $PATH
What it means
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.
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
Example fix
// before (Dockerfile) FROM rust:slim // after (Dockerfile) FROM rust:slim RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
Defensive patterns
Strategy: validation
Validate before calling
fn ensure_git_installed() -> anyhow::Result<()> {
let ok = std::process::Command::new("git").arg("--version").output()
.map(|o| o.status.success()).unwrap_or(false);
if ok { Ok(()) } else { Err(anyhow!("git is not available on $PATH")) }
} Type guard
fn git_available() -> bool {
std::process::Command::new("git").arg("--version").output()
.map(|o| o.status.success()).unwrap_or(false)
} Try / catch
match repo.clone(url, path).await {
Err(e) if e.to_string().contains("not installed") => eprintln!("Install git first: {}", e),
Err(e) => return Err(e),
Ok(v) => v,
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
AI-assisted analysis of moghtech/komodo@780ac68b99 (2026-09-08).
Data as JSON: /api/errors/13566d77b200d324.
Report an issue: GitHub.
Appendix: source
Thrown at lib/git/src/installed.rs:17
use std::time::Duration;
use anyhow::anyhow;
use command::{CommandOptions, run_standard_command};
/// Returns error if git not installed
pub async fn check_installed() -> anyhow::Result<()> {
if run_standard_command(
"which git",
CommandOptions::default().timeout(Duration::from_secs(2)),
)
.await
.success()
{
Ok(())
} else {
Err(anyhow!(
"Failed: 'git' is not installed or available on $PATH"
))
}
}
View on GitHub (pinned to 780ac68b99)