jdx/mise · error

cannot apply: {reason}

Error message

cannot apply: {reason}

What it means

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.

Source

Thrown at src/cli/dotfiles/pull.rs:58

    yes: bool,

    /// Resolve a conflict with the repository's version
    #[usage(long, value_name = "PATH")]
    take_remote: Vec<PathBuf>,

    /// Resolve a conflict by keeping this machine's version (published next)
    #[usage(long, value_name = "PATH")]
    keep_local: Vec<PathBuf>,
}

impl DotfilesPull {
    pub(crate) async fn run(self) -> Result<()> {
        if !crate::config::Settings::get().history.enabled {
            bail!("history is disabled (history.enabled = false)");
        }
        let (store, tracked, _) = super::history::open().await?;
        if let Some(reason) = store.unavailable() {
            bail!("cannot apply: {reason}");
        }
        apply::apply(
            &store,
            &tracked,
            &ApplyRequest {
                paths: self.paths.clone(),
                dry_run: self.dry_run,
                yes: self.yes,
                take_remote: self.take_remote.clone(),
                keep_local: self.keep_local.clone(),
                automatic: false,
                plan_only: false,
            },
        )
        .await?;
        Ok(())
    }
}

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Read the printed reason and complete the indicated setup step
  2. Run `mise bootstrap dotfiles history --pending` to list incomplete operations and `--recover` them
  3. Re-initialize the dotfiles history store via the bootstrap setup flow
  4. Check the history state directory for corruption or permission issues

Example fix

// before
mise bootstrap dotfiles pull  # cannot apply: setup incomplete
// after
mise bootstrap dotfiles history --pending
mise bootstrap dotfiles history --recover <id>
mise bootstrap dotfiles pull
Defensive patterns

Strategy: validation

Validate before calling

# verify store health before pulling
if ! mise bootstrap dotfiles history --pending >/dev/null 2>&1; then
  echo "history store unavailable" >&2; exit 1
fi
mise bootstrap dotfiles pull

Try / catch

if ! mise bootstrap dotfiles pull; then
  mise bootstrap dotfiles history --pending
  exit 1
fi

Prevention

When it happens

Trigger: Running `mise bootstrap dotfiles pull` when the opened history store reports itself unavailable via store.unavailable() — e.g. unfinished setup or broken state directory.

Common situations: 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.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/9b9e1777fb584a1c. Report an issue: GitHub.