SeleniumHQ/selenium · error · anyhow::Error

Failed to get parent directory of JRE install root

Error message

Failed to get parent directory of JRE install root

What it means

Error "Failed to get parent directory of JRE install root" thrown in SeleniumHQ/selenium.

Source

Thrown at rust/src/jre.rs:79

    openjdk_version: Option<String>,
    semver: Option<String>,
}

pub fn ensure_jre(
    cache_path: Option<&str>,
    timeout: u64,
    proxy: Option<&str>,
    offline: bool,
    log: &Logger,
) -> Result<JavaRuntime, Error> {
    if let Some(runtime) = detect_system_java(log)? {
        return Ok(runtime);
    }

    let install_root = resolve_managed_jre_root(cache_path);
    let install_parent = install_root
        .parent()
        .ok_or_else(|| anyhow!("Failed to get parent directory of JRE install root"))?
        .to_path_buf();
    if let Some(runtime) = detect_managed_jre_candidate(&install_root)? {
        return Ok(runtime);
    }

    // Hold the lock in the stable parent directory because installation removes and
    // recreates install_root while extracting archives into the parent cache folder.
    let _lock = Lock::acquire(log, &install_parent, None)?;
    if let Some(runtime) = detect_managed_jre_candidate(&install_root)? {
        return Ok(runtime);
    }

    if offline {
        return Err(Error::msg(
            "Java not found and cannot be downloaded in offline mode",
        ));
    }

View on GitHub (pinned to aa36b38e69)

Solutions

  1. Set --cache-path (or the default cache folder) to a normal directory with a parent, not the filesystem root
  2. Check that the cache path configuration is a valid, writable directory

When it happens

Trigger: Thrown at rust/src/jre.rs:79 when the library encounters an invalid state.

Common situations: Occurs when the JRE install root path has no parent directory. Ensure the download/cache directory path is valid and writable.


AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14). Data as JSON: /api/errors/900c78c4f99ffd86. Report an issue: GitHub.