{"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":368,"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    for (key, target) in declared {\n        if target.is_symlink() {\n            // This resolver is read-only, follows dangling chains, and bounds\n            // traversal so cyclic links cannot hang an advisory check.\n            let source = match resolve_symlink_source(target) {\n                Ok(source) => source,\n                Err(error) => {\n                    warn!(\n                        \"dotfiles: {key} is a symlink; history saves and syncs the link, not its contents. Could not resolve its source: {error}\"\n                    );\n                    continue;\n                }\n            };\n            if !tracked.would_capture(&source)? {\n                warn!(","sourceCodeStart":350,"sourceCodeEnd":386,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/cli/dotfiles/track.rs#L350-L386","documentation":"After activating tracking for a target, activate_and_baseline() verifies the target actually appears in the loaded tracked set. If the target's displayed path matches an entry marked invalid, that reason is reported; otherwise the generic 'the declaration was not loaded' reason is used, and the whole enrollment aborts.","triggerScenarios":"Running `mise dot track <target>` where the freshly written declaration is rejected/filtered when reloaded (invalid entry recorded by the tracked store), or where the declaration was not loaded into the current Config at all.","commonSituations":"The declaration file has a syntax or schema issue so the new entry does not load; the path contains characters that get normalized differently (e.g. symlinks, case differences) so the invalid entry's path doesn't match; permission problems making the store reject the path.","solutions":["Read the reported reason and fix the underlying problem (permissions, path validity), then re-run `mise dot track`","Check the declaration file for entries marked invalid and remove/repair them","Verify the target path resolves to the exact same normalized key (no symlink/case drift)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"mise dot track ~/.gitconfig || { mise dot ls; test -f ~/.gitconfig && echo 'target exists; inspect declaration file'; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify the target path exists and resolves (no broken symlinks) before tracking","Keep the declaration file valid TOML so reloads succeed","Check `mise dot ls` after tracking to confirm enrollment took effect"],"tags":["dotfiles","tracking","declaration","state"],"backgroundTag":"record-not-found","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}