{"record":{"id":"a152566601211a1f","repo":"jdx/mise","slug":"source-is-required-for-the-home-directory-itself","errorCode":null,"errorMessage":"source is required for the home directory itself","messagePattern":"source is required for the home directory itself","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/files.rs","lineNumber":1173,"sourceCode":"            FileMode::Symlink\n        }\n    }\n}\n\npub(crate) fn dotfiles_root() -> PathBuf {\n    file::replace_path(&Settings::get().dotfiles.root)\n}\n\npub(crate) fn implied_source(target: &Path) -> Result<PathBuf> {\n    let home: &Path = &dirs::HOME;\n    let rel = target.strip_prefix(home).map_err(|_| {\n        eyre::eyre!(\n            \"source is required for targets outside $HOME: {}\",\n            target.display_user()\n        )\n    })?;\n    if rel.as_os_str().is_empty() {\n        bail!(\"source is required for the home directory itself\");\n    }\n    Ok(dotfiles_root().join(rel))\n}\n\npub(crate) fn source_is_implied(req: &FileRequest) -> bool {\n    if req.mode == FileMode::Content {\n        return false;\n    }\n    match implied_source(&req.target) {\n        Ok(source) => source == req.source,\n        Err(_) => false,\n    }\n}\n\npub(crate) fn resolve_target_arg(target: &str) -> PathBuf {\n    lexical_normalize(&file::replace_path(target))\n}\n","sourceCodeStart":1155,"sourceCodeEnd":1191,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/files.rs#L1155-L1191","documentation":"implied_source derives a dotfile's source path from the target's location relative to $HOME. When the target IS the home directory itself, the relative path is empty and no meaningful source can be derived, so it bails. Users must declare an explicit `source` for that target.","triggerScenarios":"A non-track dotfile entry with no `source`, no `content`, and no variant-implied source whose target resolves to $HOME (e.g. target `~` or `~/.`), passed through implied_source via validate_incoming_files, merge_file_entry, or source_is_implied.","commonSituations":"Trying to dotfile-manage the entire home directory with `\"~\" = { mode = \"copy\" }`; a target path that over-normalizes to empty; miswritten expansion like `\"~/.\"`.","solutions":["Add an explicit `source` to the entry for the home-directory target.","Target a specific file or subdirectory instead of $HOME itself.","If the whole home should be tracked, use `mode = \"track\"`, which needs no source."],"exampleFix":"// before\n\"~\" = { mode = \"copy\" }\n// after\n\"~\" = { mode = \"track\" }","handlingStrategy":"validation","validationCode":"let rel = target.strip_prefix(home())?;\nif rel.as_os_str().is_empty() {\n    return Err(\"target is $HOME itself; an explicit source is required (or use mode=track)\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never target $HOME itself for copy/symlink dotfiles.","Use track mode if the home directory needs in-place management.","Verify target expansion (~, ~/, ~/. all collapse to HOME)."],"tags":["dotfiles","source-resolution","mise"],"backgroundTag":"missing-required-config-field","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"}