{"record":{"id":"cd8c22e95158fa72","repo":"Hmbown/CodeWhale","slug":"git-not-found-on-path-cd8c22","errorCode":null,"errorMessage":"git not found on PATH","messagePattern":"git not found on PATH","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/snapshot/repo.rs","lineNumber":1174,"sourceCode":"                &[\"update-ref\", \"HEAD\", &final_sha],\n            )?;\n            if !up.status.success() {\n                return Err(io_other(format!(\n                    \"update-ref HEAD failed: {}\",\n                    String::from_utf8_lossy(&up.stderr).trim()\n                )));\n            }\n        }\n        Ok(())\n    }\n\n    /// Run a `commit-tree` invocation with the author/committer dates pinned\n    /// to `timestamp` (Unix seconds), so a rebuilt survivor keeps its real\n    /// age instead of stamping \"now\".\n    fn commit_tree_preserving_date(&self, args: &[&str], timestamp: i64) -> io::Result<String> {\n        let date = format!(\"{timestamp} +0000\");\n        let out = crate::dependencies::Git::command()\n            .ok_or_else(|| io::Error::new(io::ErrorKind::NotFound, \"git not found on PATH\"))?\n            .arg(\"--git-dir\")\n            .arg(&self.git_dir)\n            .arg(\"--work-tree\")\n            .arg(&self.work_tree)\n            .env(\"GIT_AUTHOR_DATE\", &date)\n            .env(\"GIT_COMMITTER_DATE\", &date)\n            .args(args)\n            .output()?;\n        if !out.status.success() {\n            return Err(io_other(format!(\n                \"commit-tree failed: {}\",\n                String::from_utf8_lossy(&out.stderr).trim()\n            )));\n        }\n        Ok(String::from_utf8_lossy(&out.stdout).trim().to_string())\n    }\n\n    /// Keep only the latest `max_count` snapshots, dropping older ones.","sourceCodeStart":1156,"sourceCodeEnd":1192,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/snapshot/repo.rs#L1156-L1192","documentation":"commit_tree_preserving_date in the snapshot repo module shells out to git via crate::dependencies::Git::command(), which resolves the git executable on PATH. When no git binary is found it returns an io::Error of kind NotFound with this message. The snapshot subsystem needs git for commit-tree plumbing, so without it snapshot rebuilds cannot proceed.","triggerScenarios":"Calling rebuild_survivor_chain -> commit_tree_preserving_date when the git executable is absent from PATH at the moment the TUI process runs (Git::command() returns None).","commonSituations":"TUI launched from a desktop launcher or systemd unit with a minimal PATH that excludes /usr/bin; running inside a slim Docker image or CI container without git installed; broken PATH after shell config changes.","solutions":["Install git (e.g. `apt install git`, `brew install git`) so it resolves on PATH.","Relaunch the app from a shell with a normal PATH, or add git's directory to PATH in the launch environment.","If git lives in a nonstandard location, prepend its directory: PATH=/opt/git/bin:$PATH codewhale.","In code, surface a clear user-facing setup hint when Git::command() returns None instead of a bare NotFound io error."],"exampleFix":"// before\ncodewhale  # launched from GUI, PATH=/usr/local/bin:/usr/bin (no git installed)\n// after\nsudo apt-get install -y git && codewhale","handlingStrategy":"fallback","validationCode":"// shell, before launching\nwhich git || { echo \"git required on PATH\"; exit 1; }","typeGuard":null,"tryCatchPattern":"// rust, around snapshot rebuild\nmatch commit_tree_preserving_date(&args, ts) {\n    Err(e) if e.kind() == std::io::ErrorKind::NotFound => {\n        eprintln!(\"git is not installed or not on PATH; snapshot rebuild skipped: {e}\");\n    }\n    other => other?,\n}","preventionTips":["Install git in every environment (dev, CI, containers) that runs the app.","Check `which git` in setup scripts or app startup before snapshot features run.","Avoid GUI/systemd launches with stripped PATH; set an explicit PATH in the unit or launcher."],"tags":["git","environment","path","external-process"],"backgroundTag":"command-not-found","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}