Canop/broot · error

Unable to find configuration directories

Error message

Unable to find configuration directories

What it means

Panic in get_fish_dir as a last-resort fallback: when ~/.config/fish does not exist (and BaseDirs was unavailable), the code probes ProjectDirs::from("fish", "fish", "fish"); if even that returns None — no valid home/config directories on the system — the .expect panics. It means broot cannot locate any fish configuration directory in which to install its function.

Solutions

  1. Create ~/.config/fish so the primary detection branch succeeds
  2. Ensure HOME is set and points to an existing readable directory
  3. Install/configure fish itself so its standard config directory exists before running `broot install`
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/shell_install/fish.rs:66 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/be0087b6e73ef406. Report an issue: GitHub.

Appendix: source

Thrown at src/shell_install/fish.rs:66

        return $code
    end
end
";

pub fn get_script() -> &'static str {
    FISH_FUNC
}

/// return the root of fish's config
fn get_fish_dir() -> PathBuf {
    if let Some(base_dirs) = BaseDirs::new() {
        let fish_dir = base_dirs.home_dir().join(".config/fish");
        if fish_dir.exists() {
            return fish_dir;
        }
    }
    ProjectDirs::from("fish", "fish", "fish") // hem...
        .expect("Unable to find configuration directories")
        .config_dir()
        .to_path_buf()
}

/// return the fish functions directory
fn get_fish_functions_dir() -> PathBuf {
    get_fish_dir().join("functions")
}

/// return the path to the link to the function script
///
/// At version 0.10.4 we change the location of the script:
/// It was previously with the link, but it's now in
/// ~/.config/fish/functions/br.fish
fn get_link_path() -> PathBuf {
    get_fish_functions_dir().join("br.fish")
}

View on GitHub (pinned to 17204794d7)