{"record":{"id":"48386a4a220c2020","repo":"jdx/mise","slug":"repos-has-local-changes-commit-stash-or-cle","errorCode":null,"errorMessage":"repos: {} has local changes; commit, stash, or clean them before bootstrap","messagePattern":"repos: (.+?) has local changes; commit, stash, or clean them before bootstrap","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/repos.rs","lineNumber":164,"sourceCode":"\nimpl std::fmt::Display for RepoRequest {\n    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n        write!(f, \"{}\", file::display_path(&self.path))\n    }\n}\n\npub(crate) async fn status(requests: &[RepoRequest]) -> Result<Vec<RepoStatus>> {\n    crate::parallel::parallel(requests.to_vec(), |request| async move {\n        tokio::task::spawn_blocking(move || status_one(&request)).await?\n    })\n    .await\n}\n\npub(crate) fn preflight_statuses(statuses: &[RepoStatus]) -> Result<()> {\n    for status in statuses {\n        match &status.state {\n            RepoState::Dirty => {\n                bail!(\n                    \"repos: {} has local changes; commit, stash, or clean them before bootstrap\",\n                    status.request\n                );\n            }\n            RepoState::Conflict(reason) => {\n                bail!(\"repos: {}: {reason}\", status.request);\n            }\n            RepoState::Current | RepoState::Missing | RepoState::Differs => {}\n        }\n    }\n    Ok(())\n}\n\n/// Apply statuses previously validated with [`preflight_statuses`].\npub(crate) fn apply_statuses(statuses: &[RepoStatus], dry_run: bool) -> Result<()> {\n    for status in statuses {\n        match &status.state {\n            RepoState::Current => {","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/repos.rs#L146-L182","documentation":"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.","triggerScenarios":"Running the bootstrap command while a configured repo checkout has `git status` changes (modified files, staged edits, untracked files) that block a safe update.","commonSituations":"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.","solutions":["Run `git add`/`git commit` inside the listed repo to save local changes, then rerun bootstrap","Run `git stash` (or `git stash -u` for untracked files) to set the worktree aside, rerun bootstrap, then `git stash pop`","Discard the changes deliberately with `git restore .` / `git clean -fd` if they are unwanted"],"exampleFix":"# before (fails: dirty worktree)\nmise bootstrap\n# after\ncd ~/src/dotfiles && git add -A && git commit -m \"wip\" && cd -\nmise bootstrap","handlingStrategy":"try-catch","validationCode":"git -C <repo-path> status --porcelain | grep -q . && echo 'repo dirty: commit or stash before bootstrap'","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"has local changes\") => {\n        eprintln!(\"run git stash or commit in the listed repo, then retry\");\n    }\n    Err(e) => return Err(e),\n    Ok(v) => v,\n}","preventionTips":["Run `git status --porcelain` in each configured repo before bootstrapping","Avoid editing files inside bootstrapped checkouts; use forks/worktrees for local work","Automate `git stash`/commit hygiene in pre-bootstrap scripts"],"tags":["git","dirty-worktree","bootstrap","state-conflict"],"backgroundTag":"git-command-failed","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}