jdx/mise · error
git diff failed
Error message
git diff failed: {} What it means
The no-index diff path writes decrypted snapshot contents to temporary files and runs `git diff --no-index` on them; exit codes 0 and 1 are both acceptable (1 just means differences). Any other status means the diff tool itself failed, and this bail includes git's stderr. It protects the caller from presenting garbage (empty/failed output) as a diff.
Solutions
- Check that `git` is installed, on PATH, and functional (`git --version`).
- Free disk space in the temp directory — missing/unwritable temp plaintext files make the diff exit non-0/1.
- Inspect the stderr in the message; if it reports a missing temp file, ensure nothing is cleaning /tmp during the operation.
- Re-run the diff; transient interference (e.g. from security software) may be one-off.
Defensive patterns
Strategy: fallback
Validate before calling
# preflight the no-index diff dependencies
git --version && \
df -h "${TMPDIR:-/tmp}" | awk 'NR==2{exit ($5+0 > 95 ? 1 : 0)}' Try / catch
// Rust
match diff_no_index(left, right) {
Ok(text) => show(text),
Err(e) if e.to_string().starts_with("git diff failed:") => {
eprintln!("no-index diff failed; check git install and temp space");
}
Err(e) => return Err(e),
} Prevention
- Ensure git is installed and on PATH before using history diff features.
- Keep ample free space in the temp directory for decrypted plaintext temp files.
- Exclude /tmp (or TMPDIR) from aggressive cleaners during diff operations.
When it happens
Trigger: `git diff --no-index --color=never -- <left_name> <right_name>` exits with a code outside {0,1} — e.g. 128 when a temp file disappeared, git is missing/broken, or arguments are malformed — at shadow.rs:1254 during decrypted plaintext diffing.
Common situations: The system git binary is missing or incompatible, /tmp filled up so temp plaintext files could not be written/read, or a sandbox/antivirus removed the temp files mid-diff.
Understand the failure class
Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.
Related errors
- git diff failed ( )
- git diff failed ( )
- is not in either snapshot
- path is not in either snapshot
- a branch name is required
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/da136197bd615ad4.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/history/shadow.rs:1254
&& mode != "160000"
{
right_file.write_all(&self.cat_object(oid)?)?;
}
let left_name = left_file.path().to_string_lossy().to_string();
let right_name = right_file.path().to_string_lossy().to_string();
let diff = self.git.output_unchecked(PlumbingCall::new([
"diff",
"--no-index",
"--no-ext-diff",
"--no-textconv",
"--patch",
"--color=never",
"--",
&left_name,
&right_name,
]))?;
if !matches!(diff.status.code(), Some(0 | 1)) {
bail!("git diff failed: {}", String::from_utf8_lossy(&diff.stderr));
}
let text = String::from_utf8_lossy(&diff.stdout)
.replace(left_name.trim_start_matches('/'), &left_path)
.replace(right_name.trim_start_matches('/'), &right_path);
output.extend_from_slice(text.as_bytes());
if left.as_ref().map(|v| &v.0) != right.as_ref().map(|v| &v.0) {
output.extend_from_slice(
format!(
"{right_path}: mode {} -> {}\n",
left.as_ref().map_or("absent", |v| v.0.as_str()),
right.as_ref().map_or("absent", |v| v.0.as_str())
)
.as_bytes(),
);
}
}
Ok(DiffResult { output, changed })
}View on GitHub (pinned to 533346cc37)