{"record":{"id":"c5dc0c2c6747763a","repo":"jdx/mise","slug":"dotfiles-key-could-not-be-tracked-reason","errorCode":null,"errorMessage":"dotfiles: {key} could not be tracked: {reason}","messagePattern":"dotfiles: (.+?) could not be tracked: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/dotfiles/track.rs","lineNumber":352,"sourceCode":"}\n\n/// Checks that every declared entry is active and saves their baseline.\nasync fn activate_and_baseline(declared: &[(String, PathBuf)]) -> Result<()> {\n    let config = Config::reset().await?;\n    let tracked = TrackedSet::from_config(&config)?;\n    for (key, target) in declared {\n        let path = normalize_target(target);\n        let active = tracked\n            .entry_for(&path)\n            .is_some_and(|entry| entry.path == path);\n        if !active {\n            let reason = tracked\n                .invalid\n                .iter()\n                .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","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/cli/dotfiles/track.rs#L334-L370","documentation":"After activating a tracked declaration, mise verifies each path actually landed in the tracked set. If a path is still reported invalid (or the declaration was never loaded), track aborts with 'could not be tracked' and includes the per-path invalid reason captured in `tracked.invalid`.","triggerScenarios":"`dotfiles track` -> activate_and_baseline: the path remains in `tracked.invalid` after activation (e.g. excluded by a rule, unresolvable, outside allowed roots), or the declaration edit failed to load so no entry exists.","commonSituations":"Trying to track a path disallowed by portability/exclusion rules; a malformed declaration TOML that silently failed to load; symlinks pointing outside allowed locations.","solutions":["Read the `{reason}` in the message — it names the exact invalid entry cause","Fix the declaration file entry (path spelling, excluded rule, portability)","Ensure the declaration file is valid TOML and in a location mise loads","Retry track after correcting, then let the baseline save run"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"mise bootstrap dotfiles status --target \"$path\" >/dev/null 2>&1 && echo tracked || echo 'not tracked / invalid'","typeGuard":null,"tryCatchPattern":"if out=$(mise bootstrap dotfiles track \"$p\" 2>&1); then :; else\n  echo \"track failed for $p: $out\"  # reason names the invalid entry\nfi","preventionTips":["Validate declaration TOML before track (mise should load it cleanly)","Keep tracked paths inside allowed/portable roots","Remove exclusion rules that cover paths you intend to track"],"tags":["dotfiles","validation","config"],"backgroundTag":"invalid-argument-value","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"}