{"record":{"id":"9b9e1777fb584a1c","repo":"jdx/mise","slug":"cannot-apply-reason","errorCode":null,"errorMessage":"cannot apply: {reason}","messagePattern":"cannot apply: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/dotfiles/pull.rs","lineNumber":58,"sourceCode":"    yes: bool,\n\n    /// Resolve a conflict with the repository's version\n    #[usage(long, value_name = \"PATH\")]\n    take_remote: Vec<PathBuf>,\n\n    /// Resolve a conflict by keeping this machine's version (published next)\n    #[usage(long, value_name = \"PATH\")]\n    keep_local: Vec<PathBuf>,\n}\n\nimpl DotfilesPull {\n    pub(crate) async fn run(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 apply: {reason}\");\n        }\n        apply::apply(\n            &store,\n            &tracked,\n            &ApplyRequest {\n                paths: self.paths.clone(),\n                dry_run: self.dry_run,\n                yes: self.yes,\n                take_remote: self.take_remote.clone(),\n                keep_local: self.keep_local.clone(),\n                automatic: false,\n                plan_only: false,\n            },\n        )\n        .await?;\n        Ok(())\n    }\n}","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/cli/dotfiles/pull.rs#L40-L76","documentation":"Thrown by `mise bootstrap dotfiles pull` (run) after opening the history store when `store.unavailable()` returns a reason. The store exists as a concept but cannot serve apply operations (setup incomplete, locked, or corrupted state), so applying remote changes is refused.","triggerScenarios":"Running `mise bootstrap dotfiles pull` when the opened history store reports itself unavailable via store.unavailable() — e.g. unfinished setup or broken state directory.","commonSituations":"Fresh machine where the dotfiles store was never initialized; interrupted bootstrap leaving the store in a setup state; corrupted or missing state files in the history directory.","solutions":["Read the printed reason and complete the indicated setup step","Run `mise bootstrap dotfiles history --pending` to list incomplete operations and `--recover` them","Re-initialize the dotfiles history store via the bootstrap setup flow","Check the history state directory for corruption or permission issues"],"exampleFix":"// before\nmise bootstrap dotfiles pull  # cannot apply: setup incomplete\n// after\nmise bootstrap dotfiles history --pending\nmise bootstrap dotfiles history --recover <id>\nmise bootstrap dotfiles pull","handlingStrategy":"validation","validationCode":"# verify store health before pulling\nif ! mise bootstrap dotfiles history --pending >/dev/null 2>&1; then\n  echo \"history store unavailable\" >&2; exit 1\nfi\nmise bootstrap dotfiles pull","typeGuard":null,"tryCatchPattern":"if ! mise bootstrap dotfiles pull; then\n  mise bootstrap dotfiles history --pending\n  exit 1\nfi","preventionTips":["Initialize the history store on new machines before pulling","Recover pending operations promptly after interruptions","Back up and validate the history state directory after disk issues"],"tags":["cli","dotfiles","store","invalid-state"],"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-14T00:17:10.932Z"}