jdx/mise · error

repos: has local changes; commit, stash, or clean them…

Error message

repos: {} has local changes; commit, stash, or clean them before bootstrap

What it means

Before bootstrap mutates repos, preflight_statuses inspects each checkout's git state. A repo classified RepoState::Dirty has uncommitted modifications, untracked/conflicting worktree content, so applying updates could destroy local work; bootstrap aborts with this error. The user must resolve the working tree first.

Solutions

  1. Run `git add`/`git commit` inside the listed repo to save local changes, then rerun bootstrap
  2. Run `git stash` (or `git stash -u` for untracked files) to set the worktree aside, rerun bootstrap, then `git stash pop`
  3. Discard the changes deliberately with `git restore .` / `git clean -fd` if they are unwanted

Example fix

# before (fails: dirty worktree)
mise bootstrap
# after
cd ~/src/dotfiles && git add -A && git commit -m "wip" && cd -
mise bootstrap
Defensive patterns

Strategy: try-catch

Validate before calling

git -C <repo-path> status --porcelain | grep -q . && echo 'repo dirty: commit or stash before bootstrap'

Try / catch

match result {
    Err(e) if e.to_string().contains("has local changes") => {
        eprintln!("run git stash or commit in the listed repo, then retry");
    }
    Err(e) => return Err(e),
    Ok(v) => v,
}

Prevention

When it happens

Trigger: Running the bootstrap command while a configured repo checkout has `git status` changes (modified files, staged edits, untracked files) that block a safe update.

Common situations: Editing files inside a bootstrapped repo (e.g. dotfiles) and forgetting to commit before re-running bootstrap; a crashed tool leaving stray files in the checkout; switching branches manually with local edits.

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/48386a4a220c2020. Report an issue: GitHub.

Appendix: source

Thrown at src/system/repos.rs:164

impl std::fmt::Display for RepoRequest {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", file::display_path(&self.path))
    }
}

pub(crate) async fn status(requests: &[RepoRequest]) -> Result<Vec<RepoStatus>> {
    crate::parallel::parallel(requests.to_vec(), |request| async move {
        tokio::task::spawn_blocking(move || status_one(&request)).await?
    })
    .await
}

pub(crate) fn preflight_statuses(statuses: &[RepoStatus]) -> Result<()> {
    for status in statuses {
        match &status.state {
            RepoState::Dirty => {
                bail!(
                    "repos: {} has local changes; commit, stash, or clean them before bootstrap",
                    status.request
                );
            }
            RepoState::Conflict(reason) => {
                bail!("repos: {}: {reason}", status.request);
            }
            RepoState::Current | RepoState::Missing | RepoState::Differs => {}
        }
    }
    Ok(())
}

/// Apply statuses previously validated with [`preflight_statuses`].
pub(crate) fn apply_statuses(statuses: &[RepoStatus], dry_run: bool) -> Result<()> {
    for status in statuses {
        match &status.state {
            RepoState::Current => {

View on GitHub (pinned to 533346cc37)