jdx/mise · error
repository operation failed
Error message
repository operation failed ({}) What it means
The synchronous `git` helper in remote_repository runs a `git -C <path>` subprocess and, when git exits non-zero, wraps the exit status into this generic error. It means a git operation against the local mirror/repository backing remote mise state failed; the specific git stderr is not included, only the status code.
Solutions
- Inspect the repository directory and run the failing git command manually to see the real stderr
- Re-create/clean the repository state (delete the mirror and let mise re-initialize) if it is corrupt
- Resolve file conflicts/locks from concurrent runs (remove stale .lock files, stop parallel mise invocations)
- Check directory permissions and free disk space
Defensive patterns
Strategy: try-catch
Validate before calling
// pre-check before operations
const st = fs.statSync(repoPath);
if (!st.isDirectory()) throw new Error('repository path missing'); Try / catch
match git(path, args) {
Ok(out) => out,
Err(e) if e.to_string().starts_with("repository operation failed") => {
// run the same git command manually to capture stderr, then recover
eprintln!("git {:?} failed: {e}; inspect repo at {:?}", args, path);
recover_or_reinitialize(path)
}
Err(e) => return Err(e),
} Prevention
- Check the repository directory exists and is writable before operations
- Avoid running multiple mise processes against the same remote repo concurrently
- Capture git stderr separately to make failures diagnosable
- Re-create the repo if it becomes corrupt instead of fighting it
When it happens
Trigger: Any git subcommand run by history_branch, install_at, repository, commit, or the adoption checks exits non-zero: corrupt/missing repository, unwritable directory, merge conflicts during adoption, bad refs, or git not behaving as expected.
Common situations: Repository directory deleted or corrupted mid-run; concurrent mise processes locking the repo; adopting an existing non-repo directory with conflicting files; disk-full or permission problems.
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
- cannot check staged changes in
- git -C failed
- git failed with status
- repos: command failed in
- a branch name is required
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/ec2d4d381d91f4af.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/remote_repository.rs:21
use std::{
path::{Path, PathBuf},
process::Command,
};
#[derive(Debug)]
pub(crate) struct Source {
_directory: tempfile::TempDir,
pub bundle: PathBuf,
pub revision: String,
pub origin: String,
}
fn git(path: &Path, args: &[&str]) -> Result<String> {
let mut command = Command::new("git");
crate::git::sanitize_git_command(&mut command);
let output = command.arg("-C").arg(path).args(args).output()?;
if !output.status.success() {
bail!("repository operation failed ({})", output.status);
}
Ok(String::from_utf8(output.stdout)?
.trim_end_matches('\n')
.to_string())
}
async fn git_async(path: &Path, args: &[&str]) -> Result<String> {
let mut command = Command::new("git");
crate::git::sanitize_git_command(&mut command);
command.arg("-C").arg(path).args(args);
let output = tokio::process::Command::from(command)
.kill_on_drop(true)
.output()
.await?;
if !output.status.success() {
bail!("repository operation failed ({})", output.status);
}
Ok(String::from_utf8(output.stdout)?View on GitHub (pinned to 533346cc37)