jdx/mise · error

failed to list Git-tracked files in

Error message

failed to list Git-tracked files in {}: {}

What it means

To enumerate the files a git-backed dotfile source manages, mise runs `git ls-files` (or equivalent) inside the source's repository. If the command exits non-zero, mise bails with this message carrying the source path and git's stderr (or the exit status when stderr is empty).

Solutions

  1. Run `git status` / `git ls-files` manually in the source repo to see the underlying git error and fix it (e.g. `git reset` to rebuild the index).
  2. Re-clone the dotfiles repository fresh.
  3. Fix filesystem permissions on the repository directory for the user running mise.

Example fix

# before (corrupt index)
$ mise dotfiles apply  # fails
# after
$ cd ~/dotfiles && git reset  # rebuild index, then retry mise
Defensive patterns

Strategy: validation

Validate before calling

let out = std::process::Command::new("git")
    .args(["ls-files"])
    .current_dir(source)
    .output()?;
if !out.status.success() {
    return Err(format!("git ls-files failed in {source:?}: {}", String::from_utf8_lossy(&out.stderr)));
}

Try / catch

match dotfiles_apply() {
    Err(e) if e.to_string().contains("failed to list Git-tracked files") => {
        eprintln!("repair the repo (git reset / re-clone): {e}");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Listing Git-tracked files for a dotfile source whose repository is broken: detached/corrupt index, bare repo without a work tree, permission problems, or a repo where `git ls-files` fails despite the root being locatable.

Common situations: Shallow or partially-cloned dotfiles repo with a corrupt index; running as a user without read access to the repo; repository locked by another git process; git version incompatibilities with an ancient repo format.

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


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/cada209eee53d545. Report an issue: GitHub.

Appendix: source

Thrown at src/system/files.rs:2177

        .arg("-C")
        .arg(source)
        .arg("-c")
        .arg(safe)
        .arg("-c")
        .arg("core.autocrlf=false")
        .args(["ls-files", "-z", "--cached", "--stage", "--", "."])
        .stdout(std::process::Stdio::piped())
        .stderr(std::process::Stdio::piped());
    crate::git::sanitize_git_command(&mut command);
    let output = command.output().wrap_err_with(|| {
        format!(
            "failed to list Git-tracked files in {}",
            source.display_user()
        )
    })?;
    if !output.status.success() {
        let stderr = String::from_utf8_lossy(&output.stderr).trim().to_string();
        bail!(
            "failed to list Git-tracked files in {}: {}",
            source.display_user(),
            if stderr.is_empty() {
                output.status.to_string()
            } else {
                stderr
            }
        );
    }
    output
        .stdout
        .split(|byte| *byte == 0)
        .filter(|record| !record.is_empty())
        .map(|record| {
            let tab = record
                .iter()
                .position(|byte| *byte == b'\t')
                .ok_or_else(|| {

View on GitHub (pinned to 533346cc37)