BigPizzaV3/CodexPlusPlus · error

watcher install is only supported on Windows

Error message

watcher install is only supported on Windows

What it means

The watcher auto-restart install feature manipulates the Windows registry Run key, so the non-Windows build of install_watcher is a stub that unconditionally fails with this message. Any caller on Linux/macOS gets this error.

Solutions

  1. Use the watcher install feature only on Windows, or guard the call behind cfg(windows) / a runtime OS check
  2. On non-Windows, set up the equivalent autostart yourself (systemd user unit, launchd agent, cron @reboot) pointing at the launcher
  3. Handle the error gracefully in the UI: disable or hide the watcher-install option on unsupported platforms

Example fix

// before
watcher::install_watcher(&launcher, 9222)?;
// after
if cfg!(windows) {
    watcher::install_watcher(&launcher, 9222)?;
} else {
    anyhow::bail!("watcher install requires Windows; configure a platform autostart instead");
}
Defensive patterns

Strategy: fallback

Validate before calling

if !cfg!(windows) {
    eprintln!("watcher install requires Windows");
}

Type guard

fn watcher_supported() -> bool { cfg!(windows) }

Try / catch

match watcher::install_watcher(&launcher, port) {
    Err(e) if e.to_string().contains("only supported on Windows") => setup_platform_autostart_fallback(&launcher),
    other => other?,
}

Prevention

When it happens

Trigger: Calling install_watcher (directly or via the watcher install command/UI) on a non-Windows platform, or in a build compiled without the windows cfg.

Common situations: Developer runs the watcher install command on macOS/Linux; CI tests invoke the install path on a Unix runner; user expects cross-platform auto-start support that the library does not provide.

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


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19). Data as JSON: /api/errors/dc64b80f12aef5c9. Report an issue: GitHub.

Appendix: source

Thrown at crates/codex-plus-core/src/watcher.rs:388

    None
}

#[cfg(windows)]
pub fn install_watcher(launcher_path: &Path, debug_port: u16) -> anyhow::Result<()> {
    let plan = build_watcher_install_plan(launcher_path.to_path_buf(), debug_port);
    crate::windows_integration::set_current_user_string_value(
        WATCHER_RUN_KEY,
        &plan.run_value_name,
        &plan.run_value,
    )?;
    create_startup_shortcut(launcher_path, &plan.shortcut_arguments)?;
    spawn_launcher(launcher_path, debug_port);
    Ok(())
}

#[cfg(not(windows))]
pub fn install_watcher(_launcher_path: &Path, _debug_port: u16) -> anyhow::Result<()> {
    anyhow::bail!("watcher install is only supported on Windows")
}

#[cfg(windows)]
pub fn uninstall_watcher() -> anyhow::Result<()> {
    let _ =
        crate::windows_integration::delete_current_user_value(WATCHER_RUN_KEY, WATCHER_RUN_NAME);
    if let Some(shortcut) = startup_shortcut_path() {
        let _ = std::fs::remove_file(shortcut);
    }
    stop_launcher_processes();
    Ok(())
}

#[cfg(not(windows))]
pub fn uninstall_watcher() -> anyhow::Result<()> {
    Ok(())
}

View on GitHub (pinned to b1ed92e5e4)