{"record":{"id":"bf411ae5e80248c5","repo":"jdx/mise","slug":"dotfiles-cannot-save-the-baseline-reason","errorCode":null,"errorMessage":"dotfiles: cannot save the baseline: {reason}","messagePattern":"dotfiles: cannot save the baseline: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/dotfiles/track.rs","lineNumber":367,"sourceCode":"                .find(|invalid| invalid.path == display_path(&path))\n                .map(|invalid| invalid.reason.clone())\n                .unwrap_or_else(|| \"the declaration was not loaded\".into());\n            bail!(\"dotfiles: {key} could not be tracked: {reason}\");\n        }\n    }\n    baseline(&tracked, declared).await\n}\n\n/// Saves the baseline checkpoint of newly tracked paths; a failure fails\n/// the enrollment, since an untracked file must never look protected.\nasync fn baseline(tracked: &TrackedSet, declared: &[(String, PathBuf)]) -> Result<()> {\n    if !crate::config::Settings::get().history.enabled {\n        warn!(\"dotfiles: history is disabled (history.enabled = false); no baseline saved\");\n        return Ok(());\n    }\n    let store = Store::open()?;\n    if let Some(reason) = store.unavailable() {\n        bail!(\"dotfiles: cannot save the baseline: {reason}\");\n    }\n    // A capture wrapper owns the operation lock until this child exits. It\n    // reloads enrollment and explicitly saves all current tracked files in\n    // its outcome (including manual entries), or during interruption recovery.\n    if let Some(parent) = std::env::var_os(crate::system::history::scope::ENV_VAR)\n        && crate::system::history::store::read_marker_in(&crate::dirs::STATE)?.is_some_and(\n            |marker| {\n                marker.kind == crate::system::history::store::OperationKind::Capture\n                    && parent == std::ffi::OsStr::new(&marker.uuid)\n            },\n        )\n    {\n        info!(\n            \"dotfiles: enrolled; the enclosing capture will save the baseline when the command finishes\"\n        );\n        return Ok(());\n    }\n    let names = declared","sourceCodeStart":349,"sourceCodeEnd":385,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/cli/dotfiles/track.rs#L349-L385","documentation":"After successful tracking, mise saves a baseline checkpoint of the newly tracked files. If the history Store reports itself unavailable, track aborts with 'cannot save the baseline: {reason}' so the user knows enrollment succeeded but the initial snapshot did not.","triggerScenarios":"`dotfiles track` -> baseline: history enabled, but `Store::open()`-created store returns Some(reason) from `unavailable()` — state dir problems, unsupported backend, corruption.","commonSituations":"Read-only or missing mise state directory; history store locked by a capture wrapper that died; store schema incompatibility after a mise upgrade.","solutions":["Read the `{reason}` and fix the underlying storage problem (permissions, disk, path)","Recover/stale-clear the history operation lock (the ENV_VAR capture wrapper), then re-run track or `dotfiles save`","Run `mise doctor`; if the store is corrupt, reset the dotfiles history state and re-track"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"mise bootstrap dotfiles status >/dev/null 2>&1 || echo 'history store unhealthy; baseline will fail'","typeGuard":null,"tryCatchPattern":"if ! mise bootstrap dotfiles track ~/target 2>&1; then\n  echo \"tracked but baseline may have failed; rerun 'dotfiles save' after fixing store\"\nfi","preventionTips":["Check store availability before enrollment sessions","Clear stale capture-wrapper lock markers after crashes","Keep mise state on a stable, writable filesystem"],"tags":["dotfiles","storage","checkpoint"],"backgroundTag":"file-write-failed","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"}