jdx/mise · error

source is required for the home directory itself

Error message

source is required for the home directory itself

What it means

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.

Solutions

  1. Add an explicit `source` to the entry for the home-directory target.
  2. Target a specific file or subdirectory instead of $HOME itself.
  3. If the whole home should be tracked, use `mode = "track"`, which needs no source.

Example fix

// before
"~" = { mode = "copy" }
// after
"~" = { mode = "track" }
Defensive patterns

Strategy: validation

Validate before calling

let rel = target.strip_prefix(home())?;
if rel.as_os_str().is_empty() {
    return Err("target is $HOME itself; an explicit source is required (or use mode=track)");
}

Prevention

When it happens

Trigger: 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.

Common situations: Trying to dotfile-manage the entire home directory with `"~" = { mode = "copy" }`; a target path that over-normalizes to empty; miswritten expansion like `"~/."`.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/a152566601211a1f. Report an issue: GitHub.

Appendix: source

Thrown at src/system/files.rs:1173

            FileMode::Symlink
        }
    }
}

pub(crate) fn dotfiles_root() -> PathBuf {
    file::replace_path(&Settings::get().dotfiles.root)
}

pub(crate) fn implied_source(target: &Path) -> Result<PathBuf> {
    let home: &Path = &dirs::HOME;
    let rel = target.strip_prefix(home).map_err(|_| {
        eyre::eyre!(
            "source is required for targets outside $HOME: {}",
            target.display_user()
        )
    })?;
    if rel.as_os_str().is_empty() {
        bail!("source is required for the home directory itself");
    }
    Ok(dotfiles_root().join(rel))
}

pub(crate) fn source_is_implied(req: &FileRequest) -> bool {
    if req.mode == FileMode::Content {
        return false;
    }
    match implied_source(&req.target) {
        Ok(source) => source == req.source,
        Err(_) => false,
    }
}

pub(crate) fn resolve_target_arg(target: &str) -> PathBuf {
    lexical_normalize(&file::replace_path(target))
}

View on GitHub (pinned to 533346cc37)