{"record":{"id":"0fd9c77ad63d2c30","repo":"jdx/mise","slug":"cannot-synchronize-reason","errorCode":null,"errorMessage":"cannot synchronize: {reason}","messagePattern":"cannot synchronize: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/dotfiles/sync.rs","lineNumber":49,"sourceCode":"impl DotfilesSync {\n    pub(crate) async fn run(self) -> Result<()> {\n        match self.sync().await {\n            Ok(()) => Ok(()),\n            Err(err) if self.best_effort && is_network_failure(&err) => {\n                warn!(\"history sync: {err:#}\");\n                Ok(())\n            }\n            Err(err) => Err(err),\n        }\n    }\n\n    async fn sync(&self) -> Result<()> {\n        if !crate::config::Settings::get().history.enabled {\n            bail!(\"history is disabled (history.enabled = false)\");\n        }\n        let (store, tracked, _) = super::history::open().await?;\n        if let Some(reason) = store.unavailable() {\n            bail!(\"cannot synchronize: {reason}\");\n        }\n        let mut request = SyncRequest::new(self.fetch_only);\n        request.allow_plaintext_history = self.allow_plaintext_history;\n        let outcome = run::sync(&store, &tracked, &request)?;\n        crate::system::history::sync::origin::report(&outcome);\n        Ok(())\n    }\n}\n\nfn is_network_failure(error: &eyre::Report) -> bool {\n    error\n        .downcast_ref::<crate::system::history::sync::network::NetworkError>()\n        .is_some()\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/cli/dotfiles/sync.rs#L31-L67","documentation":"After enabling-history and opening the store, sync checks `store.unavailable()` and aborts with 'cannot synchronize: {reason}' if the history store cannot be used. The store's own reason is included so the user knows what to fix.","triggerScenarios":"Running `mise dot sync` when Store::unavailable() returns Some(reason) — e.g. the store directory is missing, corrupt, version-incompatible, or not writable.","commonSituations":"Fresh machine before any history store was created; corrupted store from a crash; permission problems on the state directory; store written by an incompatible mise version.","solutions":["Read the embedded reason in the error message","Verify/create the history state directory and fix permissions","Re-initialize or repair the store if it is corrupt, then retry `mise dot sync`"],"exampleFix":"// before\nmise dot sync  // cannot synchronize: store version mismatch\n// after\nmise dot status          # inspect store state\nmise dot track ...       # re-baseline if store was reset\nmise dot sync","handlingStrategy":"try-catch","validationCode":"store_dir=~/.local/share/mise/dotfiles-history\n[ -d \"$store_dir\" ] && [ -r \"$store_dir\" ] && [ -w \"$store_dir\" ] || echo \"store dir missing or permission problem\"\nmise dot status > /dev/null || echo \"store fails to open: repair before syncing\"","typeGuard":null,"tryCatchPattern":"mise dot sync || {\n  reason=$(mise dot status 2>&1)\n  echo \"sync aborted; store state: $reason\"\n  exit 1\n}","preventionTips":["Run `mise dot status` before scripted syncs to verify store health","Fix state directory permissions after user/OS changes","Re-baseline the store after incompatible mise version changes"],"tags":["cli","dotfiles","store-unavailable","sync"],"backgroundTag":"file-read-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"}