{"record":{"id":"6daeb0becc097a83","repo":"zed-industries/zed","slug":"unable-to-open-target","errorCode":null,"errorMessage":"Unable to open target: {}","messagePattern":"Unable to open target: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui_windows/src/platform.rs","lineNumber":1300,"sourceCode":"    pub(crate) invalidate_devices: Arc<AtomicBool>,\n    /// Shared with [`WindowsPlatformState::draw_coordinator`] and every other window.\n    pub(crate) draw_coordinator: Rc<DrawCoordinator>,\n}\n\nstruct PlatformWindowCreateContext {\n    inner: Option<Result<Rc<WindowsPlatformInner>>>,\n    raw_window_handles: std::sync::Weak<RwLock<SmallVec<[SafeHwnd; 4]>>>,\n    validation_number: usize,\n    main_sender: Option<PriorityQueueSender<RunnableVariant>>,\n    main_receiver: Option<PriorityQueueReceiver<RunnableVariant>>,\n    directx_devices: Option<DirectXDevices>,\n    dispatcher: Option<Arc<WindowsDispatcher>>,\n}\n\nfn has_package_identity() -> bool {\n    let mut package_full_name_length = 0;\n    let result = unsafe {\n        windows::Win32::Storage::Packaging::Appx::GetCurrentPackageFullName(\n            &mut package_full_name_length,\n            None,\n        )\n    };\n    if result == ERROR_INSUFFICIENT_BUFFER {\n        true\n    } else if result == APPMODEL_ERROR_NO_PACKAGE {\n        false\n    } else {\n        log::warn!(\"failed to determine whether the process has package identity: {result:?}\");\n        false\n    }\n}\n\nfn open_target(target: impl AsRef<OsStr>) -> Result<()> {\n    let target = target.as_ref();\n    let ret = unsafe {\n        ShellExecuteW(","sourceCodeStart":1282,"sourceCodeEnd":1318,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/gpui_windows/src/platform.rs#L1282-L1318","documentation":"Raised in `open_target` when `ShellExecuteW(None, \"open\", target, ...)` returns a value <= 32, the Win32 convention for failure (SE_ERR_* codes such as file-not-found, no-association, or access-denied). The message embeds `std::io::Error::last_os_error()`; target may be a URL or a path being opened with the OS default handler.","triggerScenarios":"Thrown at crates/gpui_windows/src/platform.rs:1229 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Map the SE_ERR_* return code to a human-readable message instead of the raw OS error.","Check the target exists/is a valid URL before invoking ShellExecuteW.","Handle SE_ERR_NOASSOC by falling back to 'open with' or an explicit application.","Call SetLastError(0) before ShellExecuteW so last_os_error is reliable."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}