{"record":{"id":"9552387526696941","repo":"jdx/mise","slug":"changed-while-the-changes-were-being-applied-n","errorCode":null,"errorMessage":"{} changed while the changes were being applied; nothing more was written. Run `mise bootstrap dotfiles pull` again","messagePattern":"(.+?) changed while the changes were being applied; nothing more was written\\. Run `mise bootstrap dotfiles pull` again","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/sync/apply.rs","lineNumber":518,"sourceCode":"                || live_permissions(&step.path)? != step.before_mode\n            {\n                bail!(\n                    \"{} changed before application; nothing was written\",\n                    display_path(&step.path)\n                );\n            }\n        }\n        for directory in &mut directories {\n            directory.apply()?;\n        }\n        for step in &ready {\n            // the file may have changed since the plan was made: an edit\n            // that landed meanwhile is never overwritten (undo would bring\n            // back the planned version, not it)\n            if live_object(repo, &step.path)? != step.before\n                || live_permissions(&step.path)? != step.before_mode\n            {\n                bail!(\n                    \"{} changed while the changes were being applied; nothing more was written. Run `mise bootstrap dotfiles pull` again\",\n                    display_path(&step.path)\n                );\n            }\n            let pending =\n                journal::begin_changes(\"history\", &display_path(&step.path), [step.path.clone()])?;\n            touched.push(step.path.clone());\n            let affected = display_path(&step.path);\n            scope.with_operation(|op| op.affected.push(affected.clone()));\n            match &step.pending.object {\n                Some((mode, oid)) => {\n                    replay::write_path_with_mode(repo, &step.path, mode, oid, step.desired_mode)?\n                }\n                None => replay::remove(&step.path)?,\n            }\n            journal::commit_changes(pending);\n            let mut next = step.pending.next.clone();\n            let oid = step.pending.object.clone();","sourceCodeStart":500,"sourceCodeEnd":536,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/history/sync/apply.rs#L500-L536","documentation":"During application, mise re-verifies each file against the planned `before` snapshot right before writing it. If the file changed while earlier steps of the same batch were being written, apply stops mid-batch with this error: the current file and everything after it are left untouched, and the user is told to run `mise bootstrap dotfiles pull` again. This protects an in-flight edit from being overwritten (an undo would otherwise restore the planned version instead of the user's edit).","triggerScenarios":"Inside the per-step write loop, `live_object(repo, step.path) != step.before || live_permissions(&step.path) != step.before_mode` — the file changed between planning/last check and this step's write, e.g. while previous steps were being applied.","commonSituations":"Editor autosave or a watcher rewriting a dotfile while a multi-file pull is in progress; two simultaneous `mise bootstrap dotfiles` invocations racing on the same files; slow filesystem (network home) extending the apply window.","solutions":["Run `mise bootstrap dotfiles pull` again as the message instructs — the new plan incorporates the concurrent change and unapplied steps.","Ensure only one sync process runs at a time (the sync lock serializes, but external editors/tools still race).","Pause editor autosave/watchers or close editors that touch tracked dotfiles while pulling; on network homes, consider pulling when the filesystem is responsive."],"exampleFix":"# before: file changed mid-apply\nmise bootstrap dotfiles pull   # partial failure, message says rerun\n# after\nmise bootstrap dotfiles pull   # retry with a fresh plan","handlingStrategy":"retry","validationCode":"# check for active writers on tracked files before a multi-file pull\nlsof +D ~/.config 2>/dev/null | head","typeGuard":null,"tryCatchPattern":"try {\n  await pull();\n} catch (e) {\n  if (/changed while the changes were being applied/.test(e.message)) {\n    return await pull(); // message explicitly says to run pull again\n  }\n  throw e;\n}","preventionTips":["Quiesce editors, watchers, and other sync tools while pulling multiple files.","Keep the apply window short: fast local filesystems reduce the race window.","Retry pulls after mid-batch failures — unapplied steps are preserved and a fresh plan will include the concurrent change."],"tags":["sync","concurrency","race-condition","partial-write","retry"],"backgroundTag":"invalid-state-transition","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"}