BigPizzaV3/CodexPlusPlus · error · anyhow::Error
Windows shortcuts are only supported on Windows
Error message
Windows shortcuts are only supported on Windows
What it means
The non-Windows stub of windows::install_shortcuts unconditionally bails with this message. The real shortcut-creation code (Start Menu / desktop .lnk via COM) is cfg(windows)-only, so calling this function from any other platform is a hard error by design.
Solutions
- Only call install_shortcuts when compiling for / running on Windows (cfg gate or runtime check)
- Skip the shortcuts step on other platforms instead of treating it as required
- Use platform_install, which already dispatches per-OS, rather than calling windows::install_shortcuts directly
Example fix
// before windows::install_shortcuts(&options)?; // after #[cfg(windows)] windows::install_shortcuts(&options)?;
Defensive patterns
Strategy: type-guard
Validate before calling
#[cfg(windows)]
windows::install_shortcuts(&options)?;
#[cfg(not(windows))]
eprintln!("shortcut installation skipped: Windows only"); Type guard
fn supports_windows_shortcuts() -> bool { cfg!(windows) } Try / catch
if let Err(e) = install_shortcuts(&options) {
if e.to_string().contains("only supported on Windows") { eprintln!("skipped on this platform"); }
else { return Err(e); }
} Prevention
- Never call windows::install_shortcuts directly from cross-platform code; use platform_install dispatch
- Guard shortcut steps with #[cfg(windows)]
- Keep shortcut creation optional and skippable in install flows
When it happens
Trigger: Any call to install_shortcuts in a binary compiled for a non-Windows target — e.g. install flow that doesn't check cfg before invoking the shortcut step.
Common situations: Cross-platform install code paths not gated per-OS; testing install on macOS/Linux; CI running install for a linux target with shortcut steps enabled.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- Native browser compatibility is Windows-only
- watcher install is only supported on Windows
- cannot terminate Windows process id
- Cannot verify launcher process identity
- cannot wait for Windows process id
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/7ec426303f553d77.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/install/windows.rs:122
let _ = crate::windows_integration::delete_current_user_key(URL_PROTOCOL_SUBKEY);
let _ = crate::windows_integration::delete_current_user_key(&format!(
r"{DREAM_SKIN_URL_PROTOCOL_SUBKEY}\shell\open\command"
));
let _ = crate::windows_integration::delete_current_user_key(&format!(
r"{DREAM_SKIN_URL_PROTOCOL_SUBKEY}\shell\open"
));
let _ = crate::windows_integration::delete_current_user_key(&format!(
r"{DREAM_SKIN_URL_PROTOCOL_SUBKEY}\shell"
));
let _ = crate::windows_integration::delete_current_user_key(DREAM_SKIN_URL_PROTOCOL_SUBKEY);
let _ = crate::windows_integration::delete_current_user_key(LEGACY_UNINSTALL_SUBKEY);
let _ = crate::windows_integration::delete_current_user_key(UNINSTALL_SUBKEY);
Ok(())
}
#[cfg(not(windows))]
pub fn install_shortcuts(_options: &InstallOptions) -> anyhow::Result<()> {
anyhow::bail!("Windows shortcuts are only supported on Windows")
}
#[cfg(not(windows))]
pub fn uninstall_shortcuts(_options: &InstallOptions) -> anyhow::Result<()> {
anyhow::bail!("Windows shortcuts are only supported on Windows")
}
#[cfg(windows)]
fn create_entrypoint_shortcut(
path: PathBuf,
target: PathBuf,
description: &str,
icon: PathBuf,
) -> anyhow::Result<()> {
crate::windows_integration::create_shortcut(&crate::windows_integration::ShortcutSpec {
working_directory: target.parent().map(Path::to_path_buf),
path,
target,View on GitHub (pinned to b1ed92e5e4)