{"record":{"id":"8a75c6b746a21ef5","repo":"jdx/mise","slug":"invalid-dotfile-declarations-correct-them-before","errorCode":null,"errorMessage":"invalid dotfile declarations; correct them before publishing","messagePattern":"invalid dotfile declarations; correct them before publishing","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/sync/share.rs","lineNumber":39,"sourceCode":"pub(crate) struct ShareReport {\n    pub files: BTreeMap<String, SharedFile>,\n    pub checkpoint: Option<String>,\n}\n\nimpl ShareReport {\n    pub(crate) fn objects(&self) -> BTreeMap<String, (String, String)> {\n        self.files\n            .iter()\n            .map(|(path, file)| (path.clone(), (file.mode.clone(), file.oid.clone())))\n            .collect()\n    }\n}\n\n/// Read committed files, including manually saved files missing on disk.\n/// Live directory enumeration is never the authority for a saved version.\npub(crate) fn current(repo: &HistoryRepo, tracked: &TrackedSet) -> Result<ShareReport> {\n    if !tracked.invalid.is_empty() {\n        eyre::bail!(\"invalid dotfile declarations; correct them before publishing\");\n    }\n    let mut report = ShareReport::default();\n    let Some(head) = repo.ref_oid(HistoryRepo::HISTORY_REF)? else {\n        return Ok(report);\n    };\n    report.checkpoint = Some(head.clone());\n    let roots = Roots::current();\n    for file in repo.ls_tree(&head)? {\n        let (local, variant) = match roots.locate(&file.path) {\n            Located::Config(path) => (path, None),\n            Located::Tracked { path, variant } => (path, variant),\n            Located::Marker | Located::Unmapped => continue,\n        };\n        let Some(entry) = tracked.entry_for(&local) else {\n            continue;\n        };\n        if entry.variant != variant {\n            continue;","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/history/sync/share.rs#L21-L57","documentation":"share::current builds the report of dotfiles to publish and refuses to proceed when the tracked set contains invalid dotfile declarations. Publishing from a broken tracked set could share wrong or missing files, so it aborts with a request to fix the declarations first.","triggerScenarios":"Calling share::current (and thus any publish/share flow) while `tracked.invalid` is non-empty, e.g. after adding a path that failed portability, symlink, or UTF-8 validation.","commonSituations":"A dotfile declaration pointing outside home/config roots; a tracked path on a non-UTF-8 filesystem entry; a stale declaration after moving files; hand-edited manifest entries.","solutions":["Inspect the invalid entries in the tracked set and correct or remove them (e.g. `mise history track`/untrack the offending paths).","Fix path issues: keep tracked paths under home or the mise config dir, avoid symlinked parents, use UTF-8 names.","Re-run the share/publish command once `tracked.invalid` is empty."],"exampleFix":"// before: declaration for ../outside-home/settings.json\n// after: move the file under ~/ (or config dir) and re-track\nmv ../outside-home/settings.json ~/settings.json\nmise history track ~/settings.json","handlingStrategy":"validation","validationCode":"if !tracked.invalid.is_empty() {\n  eprintln!(\"fix invalid declarations: {:?}\", tracked.invalid);\n  return;\n}","typeGuard":null,"tryCatchPattern":"match share::current(&repo, &tracked) {\n  Err(e) if e.to_string().contains(\"invalid dotfile declarations\") => fix_declarations(),\n  other => other?,\n}","preventionTips":["Validate every tracked path is under home or the mise config dir when adding.","Re-track after moving dotfiles.","Periodically list tracked entries and prune stale ones."],"tags":["share","validation","config"],"backgroundTag":"invalid-config-value","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"}