zed-industries/zed · error
Can not open target path
Error message
Can not open target path: {} What it means
Raised in the 'reveal in file manager' path when `SHOpenFolderAndSelectItems` fails with an error other than ERROR_FILE_NOT_FOUND (that case is already retried via a ShellExecute fallback in the or_else). Means Explorer could not open the parent folder and highlight the item, e.g. the folder disappeared, an invalid PIDL was built, or the path no longer exists.
Solutions
- Verify the target path still exists before building PIDLs via ParseDisplayName.
- Widen the fallback: also treat ERROR_PATH_NOT_FOUND and ERROR_INVALID_HANDLE as the ShellExecute fallback case.
- Report the COM/Win32 error code to the user ('could not reveal file').
- Retry once; Explorer can transiently fail while refreshing a folder.
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at crates/gpui_windows/src/platform.rs:1274 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@916fc2b8cb (2026-08-20).
Data as JSON: /api/errors/e852b1b3fcc209b9.
Report an issue: GitHub.
Appendix: source
Thrown at crates/gpui_windows/src/platform.rs:1341
if ret.0 as isize <= 32 {
Err(anyhow::anyhow!(
"Unable to open target: {}",
std::io::Error::last_os_error()
))
} else {
Ok(())
}
}
fn open_target_in_explorer(target: &Path) -> Result<()> {
let dir = target.parent().context("No parent folder found")?;
let desktop = unsafe { SHGetDesktopFolder()? };
let mut dir_item = std::ptr::null_mut();
unsafe {
desktop.ParseDisplayName(
HWND::default(),
None,
&HSTRING::from(dir),
None,
&mut dir_item,
std::ptr::null_mut(),
)?;
}
let mut file_item = std::ptr::null_mut();
unsafe {
desktop.ParseDisplayName(
HWND::default(),
None,
&HSTRING::from(target),
None,
&mut file_item,
std::ptr::null_mut(),
)?;
}View on GitHub (pinned to 916fc2b8cb)