{"record":{"id":"2ef80807aee756b1","repo":"jdx/mise","slug":"changed-during-setup-adoption-retry-pull","errorCode":null,"errorMessage":"{} changed during setup adoption; retry pull","messagePattern":"(.+?) changed during setup adoption; retry pull","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/sync/apply.rs","lineNumber":665,"sourceCode":"                    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();\n            next.applied = oid.clone();\n            next.acknowledged = oid;\n            sync_state.insert(step.pending.branch_path.clone(), next);\n        }\n        if fresh_adoption || inventory_tree.is_some() {\n            // Verify the whole written batch again before advancing Git. A\n            // concurrent edit must not become an apparently applied setup.\n            for step in &ready {\n                if live_object(repo, &step.path)? != step.pending.object\n                    || live_permissions(&step.path)? != step.desired_mode\n                {\n                    bail!(\n                        \"{} changed during setup adoption; retry pull\",\n                        display_path(&step.path)\n                    );\n                }\n            }\n            for directory in &directories {\n                directory.verify_written()?;\n            }\n            let heads = super::graph::Heads::read(repo)?;\n            if heads.local != application_head || heads.remote != status.upstream_commit {\n                bail!(\"setup history changed during adoption; retry pull\");\n            }\n            let remote = heads.remote.as_deref().unwrap();\n            audit_incoming_history(repo, remote)?;\n            let tree = inventory_tree\n                .clone()\n                .unwrap_or(repo.output_tree_of(remote)?);\n            let candidate = heads","sourceCodeStart":647,"sourceCodeEnd":683,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/history/sync/apply.rs#L647-L683","documentation":"After writing the whole batch during setup adoption, mise verifies every written file once more against the adopted tree before advancing Git state. If any file's object or permissions no longer match what the setup adoption wrote, a concurrent edit landed during the write window; the command aborts rather than recording an apparently-applied setup built on a file that immediately changed.","triggerScenarios":"Post-write verification loop in first-time setup adoption (`mise dot pull` enrollment path): `live_object(repo, path) != step.pending.object` or `live_permissions(path) != step.desired_mode` after all writes completed.","commonSituations":"A daemon (shell config reloader, package manager, or editor session) rewrote a just-restored dotfile during adoption; the user edited files exactly while the initial pull wrote them.","solutions":["Re-run `mise dot pull` (retry) so adoption is re-verified against the current files.","Identify what rewrote the path and stop it before retrying (temporarily disable reloaders/autosave).","If the new content should win, `mise dot save <path>` then pull again."],"exampleFix":"before: mise dot pull (~/.profile changed during setup adoption) | after: stop the process rewriting ~/.profile, then mise dot pull","handlingStrategy":"retry","validationCode":"pgrep -af 'reload|autorandr|theme'  # quiesce anything that may rewrite tracked files before adoption","typeGuard":null,"tryCatchPattern":"mise dot pull || mise dot pull  # retry adoption once concurrent writers are stopped","preventionTips":["Quiesce daemons/agents that touch dotfiles during initial enrollment pulls.","Complete setup adoption in a quiet session with no open editors on tracked paths.","If the interim edit should win, `mise dot save <path>` before retrying."],"tags":["sync","race-condition","enrollment","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"}