jdx/mise · error
cannot check staged changes: git is unavailable
Error message
cannot check staged changes: git is unavailable
What it means
staged_paths shells out to git (`git diff --name-only --staged`) to detect files staged for commit so they can be skipped during apply. If no git binary can be located via plumbing_binary(), staged-change detection is impossible and the operation fails rather than risking overwrite of staged work.
Source
Thrown at src/system/history/sync/apply.rs:847
repo.restored_object_at(&head, &entry.tree_path(path)?)
}
/// Read each containing checkout's index once per preflight, not once per
/// incoming file. Never retain this observation across subsequent validation.
pub(super) fn staged_paths<'a>(paths: impl Iterator<Item = &'a Path>) -> Result<BTreeSet<PathBuf>> {
let roots: BTreeSet<_> = paths
.filter_map(|path| {
path.ancestors()
.find(|dir| dir.join(".git").exists())
.map(Path::to_path_buf)
})
.collect();
let mut staged = BTreeSet::new();
if roots.is_empty() {
return Ok(staged);
}
let Some(git) = crate::git::plumbing_binary() else {
bail!("cannot check staged changes: git is unavailable");
};
for root in roots {
let mut command = std::process::Command::new(git);
crate::git::sanitize_git_command(&mut command);
let output = command
.arg("-C")
.arg(&root)
.args([
"-c",
"core.fsmonitor=false",
"diff",
"--cached",
"--name-only",
"-z",
"--no-renames",
"--no-ext-diff",
"--no-textconv",
"--",View on GitHub (pinned to afd2eddd3a)
Solutions
- Install git (e.g. `apt-get install git`, `brew install git`) or fix PATH so `git` resolves.
- Verify with `command -v git` in the same shell that runs mise.
- If staged-change skipping is not needed, stage nothing and ensure the environment provides git on retry.
Example fix
// before (PATH lacking git) mise pull // after export PATH="/usr/bin:$PATH" # ensure git is reachable mise pull
Defensive patterns
Strategy: fallback
Validate before calling
if which("git").is_err() {
// git unavailable: install or fix PATH before pulling
} Try / catch
if let Err(e) = pull() {
if e.to_string().contains("git is unavailable") {
// install git or correct PATH, then retry
}
} Prevention
- Ensure git is installed in every environment running mise
- Keep /usr/bin and mise's PATH intact in minimal containers
- Check `command -v git` in shell profiles that mutate PATH
When it happens
Trigger: Running a pull/apply when `git` is not installed or not discoverable on PATH (git unavailable in the environment mise is managing).
Common situations: Minimal containers or CI images without git; broken PATH in a shell where mise runs; git removed after mise was set up.
Understand the failure class
Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.
Related errors
- cannot determine whether {url} is a setup repository: {reaso
- remote task path is not a regular file or directory: {}
- too many inherited Git configuration entries
- {} is not available: required binary '{binary}' not found; a
- executable identity contains an unsupported environment vari
AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09).
Data as JSON: /api/errors/ee466ab64263dffc.
Report an issue: GitHub.