jdx/mise · error

cannot save: {reason}

Error message

cannot save: {reason}

What it means

The dotfiles checkpoint save aborts up front because the history Store reports itself unavailable via `store.unavailable()`. The store knows it cannot perform writes (e.g. storage backend broken, missing state directory, unsupported layout), so save refuses before taking the operation lock.

Source

Thrown at src/cli/dotfiles/save.rs:127

        draft.description = self.description.clone();
        draft.description_source = Some(if trigger == Trigger::Agent {
            DescriptionSource::Agent
        } else {
            DescriptionSource::User
        });
        draft.task = self.task.clone();
        draft.labels = self.label.clone();
        tokio::task::spawn_blocking(move || self.save_checkpoint(&store, &tracked, draft)).await?
    }

    fn capture(
        &self,
        store: &Store,
        tracked: &crate::system::history::tracked::TrackedSet,
        draft: Draft,
    ) -> Result<()> {
        if let Some(reason) = store.unavailable() {
            bail!("cannot save: {reason}");
        }
        // a save is a write: it waits for no running operation, refuses to
        // interleave with one, and closes one that died
        let _operation = crate::system::history::scope::take_operation_lock(store, tracked)?;
        match store.attempt(tracked, draft)? {
            Outcome::Created(entry) => {
                info!(
                    "history: saved checkpoint {}: {}",
                    entry.id, entry.checkpoint.description
                );
                Ok(())
            }
            Outcome::Unchanged => {
                info!("history: nothing changed since the latest checkpoint");
                Ok(())
            }
            Outcome::Unavailable(reason) => bail!("cannot save: {reason}"),
        }

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Read the `{reason}` suffix for the concrete cause and fix that (e.g. recreate the state dir)
  2. Check mise's state directory permissions and free disk space
  3. Run `mise doctor` to diagnose history store health
  4. Disable/re-enable history or reset the dotfiles history store if corrupted
Defensive patterns

Strategy: try-catch

Validate before calling

mise bootstrap dotfiles status >/dev/null 2>&1 || echo 'history store unavailable'

Try / catch

if mise bootstrap dotfiles save 2>&1 | grep -q 'cannot save:'; then
  echo "history store unavailable: fix state dir before scripting saves"
fi

Prevention

When it happens

Trigger: Calling the save path (dotfiles save command -> capture -> save_checkpoint) when `Store::unavailable()` returns Some(reason): the history state store is in a state that forbids writes.

Common situations: State directory missing or on a read-only filesystem; history store schema too new/old; disk errors; history state corrupted by a previous crash.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


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