{"record":{"id":"900c78c4f99ffd86","repo":"SeleniumHQ/selenium","slug":"failed-to-get-parent-directory-of-jre-install-root","errorCode":null,"errorMessage":"Failed to get parent directory of JRE install root","messagePattern":"Failed to get parent directory of JRE install root","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"rust/src/jre.rs","lineNumber":79,"sourceCode":"    openjdk_version: Option<String>,\n    semver: Option<String>,\n}\n\npub fn ensure_jre(\n    cache_path: Option<&str>,\n    timeout: u64,\n    proxy: Option<&str>,\n    offline: bool,\n    log: &Logger,\n) -> Result<JavaRuntime, Error> {\n    if let Some(runtime) = detect_system_java(log)? {\n        return Ok(runtime);\n    }\n\n    let install_root = resolve_managed_jre_root(cache_path);\n    let install_parent = install_root\n        .parent()\n        .ok_or_else(|| anyhow!(\"Failed to get parent directory of JRE install root\"))?\n        .to_path_buf();\n    if let Some(runtime) = detect_managed_jre_candidate(&install_root)? {\n        return Ok(runtime);\n    }\n\n    // Hold the lock in the stable parent directory because installation removes and\n    // recreates install_root while extracting archives into the parent cache folder.\n    let _lock = Lock::acquire(log, &install_parent, None)?;\n    if let Some(runtime) = detect_managed_jre_candidate(&install_root)? {\n        return Ok(runtime);\n    }\n\n    if offline {\n        return Err(Error::msg(\n            \"Java not found and cannot be downloaded in offline mode\",\n        ));\n    }\n","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/rust/src/jre.rs#L61-L97","documentation":"Error \"Failed to get parent directory of JRE install root\" thrown in SeleniumHQ/selenium.","triggerScenarios":"Thrown at rust/src/jre.rs:79 when the library encounters an invalid state.","commonSituations":"Occurs when the JRE install root path has no parent directory. Ensure the download/cache directory path is valid and writable.","solutions":["Set --cache-path (or the default cache folder) to a normal directory with a parent, not the filesystem root","Check that the cache path configuration is a valid, writable directory"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}