{"record":{"id":"0777b302ed532d05","repo":"jdx/mise","slug":"another-setup-sync-or-pull-is-running-retry-short","errorCode":null,"errorMessage":"another setup sync or pull is running; retry shortly","messagePattern":"another setup sync or pull is running; retry shortly","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/system/history/sync/run.rs","lineNumber":518,"sourceCode":"pub(crate) fn update_status(\n    state_dir: &Path,\n    wait: Duration,\n    mutate: impl FnOnce(&mut SyncStatus),\n) -> Result<()> {\n    let _lock = lock_wait(state_dir, wait)?;\n    let mut status = read_status(state_dir)?;\n    mutate(&mut status);\n    write_status(state_dir, &status)\n}\n\npub(crate) fn lock_wait(state_dir: &Path, wait: Duration) -> Result<fslock::LockFile> {\n    let deadline = Instant::now() + wait;\n    loop {\n        if let Some(lock) = crate::lock_file::LockFile::at(&lock_path(state_dir)).try_lock()? {\n            return Ok(lock);\n        }\n        if Instant::now() >= deadline {\n            bail!(\"another setup sync or pull is running; retry shortly\");\n        }\n        std::thread::sleep(STATUS_LOCK_POLL);\n    }\n}\n\n/// A desktop notification for conflicts that newly need a decision, when\n/// `history.notify` is on. Notify once per whole-setup pause, not per path.\n/// Never blocks; a failure is only logged.\nfn notify_new_conflicts(status: &mut SyncStatus) {\n    notify_conflicts_with(\n        status,\n        crate::config::Settings::get().history.notify,\n        crate::system::history::notify::send,\n    );\n}\n\nfn notify_conflicts_with(status: &mut SyncStatus, enabled: bool, send: impl FnOnce(&str, &str)) {\n    let current: BTreeSet<String> = status","sourceCodeStart":500,"sourceCodeEnd":536,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/history/sync/run.rs#L500-L536","documentation":"mise serializes history sync/pull operations with a status lock file in the state directory. update_status's lock helper polls for the lock until a deadline (wait); if it cannot acquire the lock in time it aborts with this message rather than corrupting status by writing concurrently.","triggerScenarios":"Calling sync/pull/update_status while another `mise dot sync` or `mise dot pull` holds the status lock for longer than the configured wait deadline (long-running sync, hung process, or stale lock).","commonSituations":"Two terminals running sync/pull simultaneously; a scheduled sync overlapping an interactive one; a crashed sync that left a lock contended; a very slow sync (large repository, network stall) exceeding the wait window.","solutions":["Wait a moment for the other operation to finish, then re-run the command — the message explicitly says retry shortly.","Find the running `mise dot sync`/`mise dot pull` process (ps) and wait for it or terminate it if it is hung.","If a stale lock is left behind by a crashed process, remove the stale lock file in the mise state directory once no sync process is running, then retry."],"exampleFix":"// before: concurrent syncs\n# terminal A: mise dot sync (running)\n# terminal B: mise dot sync -> error: another setup sync or pull is running\n// after: serialize\n# terminal A: finish\n# terminal B: retry\nmise dot sync","handlingStrategy":"retry","validationCode":"// probe the lock before running\nif !try_status_lock(state_dir, Duration::ZERO) {\n    eprintln!(\"another sync/pull is running; wait and retry\");\n    return;\n}","typeGuard":null,"tryCatchPattern":"loop {\n    match sync() {\n        Err(e) if e.to_string().contains(\"another setup sync or pull is running\") => { sleep(POLL); continue; }\n        other => break other,\n    }\n}","preventionTips":["Run at most one sync/pull at a time per machine.","In scripts, use the lock probe or a retry-with-backoff wrapper around sync.","After a crashed sync, check for and clear a stale lock file before retrying."],"tags":["lock","concurrency","sync"],"backgroundTag":"address-already-in-use","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"}