{"record":{"id":"15db8e49176feb93","repo":"jdx/mise","slug":"tracking-does-not-support-non-utf-8-filenames","errorCode":null,"errorMessage":"tracking does not support non-UTF-8 filenames","messagePattern":"tracking does not support non-UTF-8 filenames","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/tracked.rs","lineNumber":795,"sourceCode":"pub(crate) fn tree_path_to_display(tree_path: &str) -> String {\n    let (stem, rest) = tree_path.split_once('/').unwrap_or((tree_path, \"\"));\n    let root = stem.split('@').next().unwrap_or(stem);\n    if root == \"config\" {\n        display_path(global_config_dir().join(rest))\n    } else if root == \"home\" {\n        format!(\"~/{rest}\")\n    } else if let Some(rest) = tree_path.strip_prefix(\"fs/\") {\n        format!(\"/{rest}\")\n    } else {\n        tree_path.to_string()\n    }\n}\n\n/// Root aliases are portable through the home/config mapping. Aliases below\n/// those roots are not: canonicalizing them would silently change the enrolled\n/// destination on another machine. The leaf itself may still be a symlink.\npub(crate) fn ensure_portable_ancestors(path: &Path) -> Result<()> {\n    eyre::ensure!(\n        path.to_str().is_some(),\n        \"tracking does not support non-UTF-8 filenames\"\n    );\n    let roots = super::sync::layout::Roots::current();\n    let bases = [\n        dirs::HOME.to_path_buf(),\n        global_config_dir(),\n        roots.home,\n        roots.config_dir,\n    ];\n    let relative = |base: &Path| {\n        let mut components = path.components();\n        for expected in base.components() {\n            let actual = components.next()?;\n            if actual != expected\n                && !(cfg!(windows)\n                    && actual\n                        .as_os_str()","sourceCodeStart":777,"sourceCodeEnd":813,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/history/tracked.rs#L777-L813","documentation":"`ensure_portable_ancestors` refuses to track (enroll) a path whose textual representation is not valid UTF-8. Portable tracking relies on mapping paths through home/config roots across machines, and non-UTF-8 filenames (common on Unix raw bytes) cannot round-trip through mise's string-based config and alias logic.","triggerScenarios":"Calling `add_requests` → `ensure_portable_ancestors(path)` where `path.to_str()` returns `None` because the path contains invalid UTF-8 bytes in any component.","commonSituations":"Enrolling a file created with non-UTF-8 locale/filename bytes (e.g. Latin-1 filename from an archive extraction); syncing dotfiles that include oddly named downloads; Linux systems without a UTF-8 locale.","solutions":["Rename the offending file/directory to a valid UTF-8 name, then re-run the tracking command.","Exclude the non-UTF-8 path from tracking and track only its UTF-8-named ancestors/contents.","Fix the system locale (`LANG`/`LC_ALL` to a UTF-8 value) and recreate the file so the name is encoded as UTF-8."],"exampleFix":"// before (shell)\nmv $'caf\\xe9.txt' 'café.txt'\nmise use --path ./café.txt\n\n// after\nmise use --path ./café.txt   # works once all path components are valid UTF-8","handlingStrategy":"type-guard","validationCode":"fn is_utf8_path(p: &std::path::Path) -> bool { p.to_str().is_some() }","typeGuard":"let name = match path.to_str() { Some(s) => s, None => { eprintln!(\"skip non-UTF-8 path: {}\", path.display()); return; } };","tryCatchPattern":null,"preventionTips":["Use UTF-8 filenames for anything you intend to track/sync.","Set LANG/LC_ALL to a UTF-8 locale before creating files.","Exclude non-UTF-8 paths from dotfile enrollment."],"tags":["filesystem","encoding","utf-8","tracking"],"backgroundTag":"unsupported-operation","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"}