Canop/broot · error

no home directory!

Error message

no home directory!

What it means

Panic in get_sourcing_paths when the user's home directory cannot be determined (the home-dir lookup returns None). The function needs the home path to resolve SOURCING_FILES entries that are relative to home (like .bashrc) before interpolating environment variables, so installation of the br shell function cannot proceed without it.

Solutions

  1. Ensure the HOME environment variable is set and points to an existing directory
  2. Run `broot install` from a normal user shell rather than a stripped environment (cron, systemd service, chroot)
  3. Alternatively use absolute paths in the shell-install sourcing configuration to avoid home-relative resolution
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/shell_install/bash.rs:94 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Canop/broot@17204794d7 (2026-09-08). Data as JSON: /api/errors/3c4ef5cf4d6fca59. Report an issue: GitHub.

Appendix: source

Thrown at src/shell_install/bash.rs:94

/// return the path to the script containing the function.
///
/// At version 0.10.4 we change the location of the script:
/// It was previously with the link, but it's now in
/// XDG_DATA_HOME (typically ~/.local/share on linux)
fn get_script_path() -> PathBuf {
    conf::app_dirs()
        .data_dir()
        .join("launcher")
        .join(NAME)
        .join(VERSION)
}

/// return the paths to the files in which the br function is sourced.
/// Paths in SOURCING_FILES can be absolute or relative to the home
/// directory. Environment variables designed as $NAME are interpolated.
fn get_sourcing_paths() -> Vec<PathBuf> {
    let homedir_path = UserDirs::new()
        .expect("no home directory!")
        .home_dir()
        .to_path_buf();
    SOURCING_FILES
        .iter()
        .map(|name| {
            regex!(r#"\$(\w+)"#)
                .replace(name, |c: &Captures<'_>| {
                    env::var(&c[1]).unwrap_or_else(|_| (*name).to_string())
                })
                .to_string()
        })
        .map(PathBuf::from)
        .map(|path| {
            if path.is_absolute() {
                path
            } else {
                homedir_path.join(path)
            }

View on GitHub (pinned to 17204794d7)