{"record":{"id":"ec2d4d381d91f4af","repo":"jdx/mise","slug":"repository-operation-failed","errorCode":null,"errorMessage":"repository operation failed ({})","messagePattern":"repository operation failed \\((.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/remote_repository.rs","lineNumber":21,"sourceCode":"use std::{\n    path::{Path, PathBuf},\n    process::Command,\n};\n\n#[derive(Debug)]\npub(crate) struct Source {\n    _directory: tempfile::TempDir,\n    pub bundle: PathBuf,\n    pub revision: String,\n    pub origin: String,\n}\n\nfn git(path: &Path, args: &[&str]) -> Result<String> {\n    let mut command = Command::new(\"git\");\n    crate::git::sanitize_git_command(&mut command);\n    let output = command.arg(\"-C\").arg(path).args(args).output()?;\n    if !output.status.success() {\n        bail!(\"repository operation failed ({})\", output.status);\n    }\n    Ok(String::from_utf8(output.stdout)?\n        .trim_end_matches('\\n')\n        .to_string())\n}\n\nasync fn git_async(path: &Path, args: &[&str]) -> Result<String> {\n    let mut command = Command::new(\"git\");\n    crate::git::sanitize_git_command(&mut command);\n    command.arg(\"-C\").arg(path).args(args);\n    let output = tokio::process::Command::from(command)\n        .kill_on_drop(true)\n        .output()\n        .await?;\n    if !output.status.success() {\n        bail!(\"repository operation failed ({})\", output.status);\n    }\n    Ok(String::from_utf8(output.stdout)?","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/remote_repository.rs#L3-L39","documentation":"remote_repository drives a local git repository (for remote-host onboarding state) by shelling out to `git -C <path> <args>`. When a synchronous git invocation exits non-zero, mise wraps nothing from stderr and instead raises this generic error containing only the exit status.","triggerScenarios":"Any git subcommand run by history_branch, install_at, repository, commit, etc. fails: not a git repository, bad ref/branch name, index lock present, merge conflicts, unreadable repo, git not on PATH (that would be an io error though — this fires specifically on non-zero exit).","commonSituations":"Corrupted or locked repo (.git/index.lock left over); detached/missing branch; conflicting changes during adoption; running in a sandbox without git credentials for an authenticated remote.","solutions":["Re-run the failing operation with the underlying git command manually in the repo path to see the real stderr","Remove stale lock files (e.g. .git/index.lock) if a previous git process crashed","Re-create the repository state (delete and let mise reinstall/reinit) if it is corrupted"],"exampleFix":"// before (stale lock)\nrm: leave .git/index.lock in place\n// after\nrm .git/index.lock && retry the mise remote operation","handlingStrategy":"retry","validationCode":"const repoHealthy = (dir) => execFileSync('git', ['-C', dir, 'status', '--porcelain'], { stdio: 'ignore' }); // throws if repo is broken","typeGuard":null,"tryCatchPattern":"try { git(dir, args); } catch (e) { if (isIndexLockError(dir)) { rmIndexLock(dir); return retry(git, dir, args); } throw e; }","preventionTips":["Manually run `git -C <repo> fsck`/`status` before automated operations","Avoid concurrent processes touching the same onboarding repo","Keep git on PATH and credentials preconfigured"],"tags":["git","subprocess","repository"],"backgroundTag":"git-command-failed","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}