{"record":{"id":"dc64b80f12aef5c9","repo":"BigPizzaV3/CodexPlusPlus","slug":"watcher-install-is-only-supported-on-windows","errorCode":null,"errorMessage":"watcher install is only supported on Windows","messagePattern":"watcher install is only supported on Windows","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/watcher.rs","lineNumber":388,"sourceCode":"    None\n}\n\n#[cfg(windows)]\npub fn install_watcher(launcher_path: &Path, debug_port: u16) -> anyhow::Result<()> {\n    let plan = build_watcher_install_plan(launcher_path.to_path_buf(), debug_port);\n    crate::windows_integration::set_current_user_string_value(\n        WATCHER_RUN_KEY,\n        &plan.run_value_name,\n        &plan.run_value,\n    )?;\n    create_startup_shortcut(launcher_path, &plan.shortcut_arguments)?;\n    spawn_launcher(launcher_path, debug_port);\n    Ok(())\n}\n\n#[cfg(not(windows))]\npub fn install_watcher(_launcher_path: &Path, _debug_port: u16) -> anyhow::Result<()> {\n    anyhow::bail!(\"watcher install is only supported on Windows\")\n}\n\n#[cfg(windows)]\npub fn uninstall_watcher() -> anyhow::Result<()> {\n    let _ =\n        crate::windows_integration::delete_current_user_value(WATCHER_RUN_KEY, WATCHER_RUN_NAME);\n    if let Some(shortcut) = startup_shortcut_path() {\n        let _ = std::fs::remove_file(shortcut);\n    }\n    stop_launcher_processes();\n    Ok(())\n}\n\n#[cfg(not(windows))]\npub fn uninstall_watcher() -> anyhow::Result<()> {\n    Ok(())\n}\n","sourceCodeStart":370,"sourceCodeEnd":406,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/watcher.rs#L370-L406","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use the watcher install feature only on Windows, or guard the call behind cfg(windows) / a runtime OS check","On non-Windows, set up the equivalent autostart yourself (systemd user unit, launchd agent, cron @reboot) pointing at the launcher","Handle the error gracefully in the UI: disable or hide the watcher-install option on unsupported platforms"],"exampleFix":"// before\nwatcher::install_watcher(&launcher, 9222)?;\n// after\nif cfg!(windows) {\n    watcher::install_watcher(&launcher, 9222)?;\n} else {\n    anyhow::bail!(\"watcher install requires Windows; configure a platform autostart instead\");\n}","handlingStrategy":"fallback","validationCode":"if !cfg!(windows) {\n    eprintln!(\"watcher install requires Windows\");\n}","typeGuard":"fn watcher_supported() -> bool { cfg!(windows) }","tryCatchPattern":"match watcher::install_watcher(&launcher, port) {\n    Err(e) if e.to_string().contains(\"only supported on Windows\") => setup_platform_autostart_fallback(&launcher),\n    other => other?,\n}","preventionTips":["Gate watcher install UI/commands behind an OS check","Document Windows-only support of the autostart watcher","Provide platform-native autostart alternatives (systemd, launchd)"],"tags":["platform","windows","unsupported"],"backgroundTag":"unsupported-platform","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}