{"record":{"id":"ff49ffe0581520b7","repo":"jdx/mise","slug":"changed-before-application-nothing-was-written","errorCode":null,"errorMessage":"{} changed before application; nothing was written","messagePattern":"(.+?) changed before application; nothing was written","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/sync/apply.rs","lineNumber":619,"sourceCode":"                        display_path(&step.path)\n                    );\n                }\n            }\n            let candidate = heads\n                .candidate(repo, tree)?\n                .ok_or_else(|| eyre::eyre!(\"setup branch disappeared\"))?;\n            audit_incoming_history(repo, &candidate.commit)?;\n        }\n        // Validate the complete batch again after acquiring the operation\n        // lock, before the first write.\n        for directory in &directories {\n            directory.validate()?;\n        }\n        for step in &ready {\n            if live_object(repo, &step.path)? != step.before\n                || 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 dot pull` again\",\n                    display_path(&step.path)","sourceCodeStart":601,"sourceCodeEnd":637,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/history/sync/apply.rs#L601-L637","documentation":"Immediately before writing the planned changes, mise re-reads every live file and compares content object and permissions against the values captured when the plan was built. If anything changed in between, nothing is written and the command aborts, naming the path — the plan is stale and applying it could clobber a concurrent edit.","triggerScenarios":"Between plan creation and application in `mise dot apply`/`mise dot pull`, any ready path's content hash (`live_object`) or mode (`live_permissions`) differs from `step.before` / `step.before_mode`.","commonSituations":"Editor autosave or a running process rewrote a dotfile while the apply prompt was open; user edited files while reviewing the confirmation; a sync agent touched files between plan and confirmation.","solutions":["Re-run `mise dot pull` (or `mise dot apply`) so a fresh plan is built against the current files.","Check the named path for what changed; if the new content should be kept, `mise dot save <path>` it first.","Avoid editing tracked files while an apply/pull confirmation is pending."],"exampleFix":"before: mise dot apply with the prompt open while an autosave rewrites ~/.zshrc (fails) | after: mise dot save ~/.zshrc && mise dot pull && mise dot apply","handlingStrategy":"retry","validationCode":"mise dot status  # and avoid editing files while an apply prompt is open","typeGuard":null,"tryCatchPattern":"mise dot apply || { mise dot status; mise dot pull; mise dot apply; }  # rebuild plan and retry once","preventionTips":["Don't edit tracked dotfiles while a pull/apply confirmation is pending.","Disable editor autosave for enrolled paths during sync operations.","Re-run the pull promptly rather than leaving a plan pending for a long time."],"tags":["sync","race-condition","dotfiles"],"backgroundTag":"checksum-mismatch","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"}