gleam-lang/gleam · error

Non Utf8 Path

Error message

Non Utf8 Path

What it means

Error "Non Utf8 Path" thrown in gleam-lang/gleam.

Source

Thrown at compiler-core/src/paths.rs:185

pub fn global_hexpm_legacy_credentials_path() -> Utf8PathBuf {
    global_hexpm_cache().join("credentials")
}

fn global_hexpm_cache() -> Utf8PathBuf {
    default_global_gleam_cache().join("hex").join("hexpm")
}

fn global_packages_cache() -> Utf8PathBuf {
    global_hexpm_cache().join("packages")
}

pub fn default_global_gleam_cache() -> Utf8PathBuf {
    Utf8PathBuf::from_path_buf(
        dirs_next::cache_dir()
            .expect("Failed to determine user cache directory")
            .join("gleam"),
    )
    .expect("Non Utf8 Path")
}

pub fn unnest(within: &Utf8Path) -> Utf8PathBuf {
    let mut path = Utf8PathBuf::new();
    for _ in within {
        path = path.join("..");
    }
    path
}

#[test]
fn paths() {
    assert!(default_global_gleam_cache().ends_with("gleam"));

    assert!(global_packages_cache().ends_with("hex/hexpm/packages"));

    assert!(
        global_package_cache_package_tarball(&Base16Checksum(vec![0, 0, 0, 0]))

View on GitHub (pinned to 7e623aa83d)

When it happens

Trigger: Thrown at compiler-core/src/paths.rs:185 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gleam-lang/gleam@7e623aa83d (2026-08-17). Data as JSON: /api/errors/8bf4b7ba005f701b. Report an issue: GitHub.