{"record":{"id":"bd5946e51e7a0d88","repo":"BigPizzaV3/CodexPlusPlus","slug":"error-bd5946","errorCode":null,"errorMessage":"启动系统浏览器失败：{error}","messagePattern":"启动系统浏览器失败：(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/codex-plus-manager/src-tauri/src/commands.rs","lineNumber":5874,"sourceCode":"            .and_then(Value::as_array)\n            .cloned()\n            .unwrap_or_default(),\n        top_ad: payload.get(\"topAd\").cloned(),\n    }\n}\n\nfn open_url(url: &str) -> anyhow::Result<()> {\n    #[cfg(windows)]\n    {\n        codex_plus_core::windows_open_url(url)\n    }\n    #[cfg(not(windows))]\n    {\n        std::process::Command::new(\"open\")\n            .arg(url)\n            .spawn()\n            .map(|_| ())\n            .map_err(|error| anyhow::anyhow!(\"启动系统浏览器失败：{error}\"))\n    }\n}\n\nfn settings_payload(message: &str, failure_context: &str) -> CommandResult<SettingsPayload> {\n    match settings_payload_value() {\n        Ok(payload) => ok(message, payload),\n        Err((error, payload)) => failed(&format!(\"{failure_context}：{error}\"), payload),\n    }\n}\n\nfn settings_payload_value() -> Result<SettingsPayload, (anyhow::Error, SettingsPayload)> {\n    let store = SettingsStore::default();\n    let settings_path = codex_plus_core::paths::default_settings_path()\n        .to_string_lossy()\n        .to_string();\n    match store.load() {\n        Ok(settings) => Ok(SettingsPayload {\n            settings,","sourceCodeStart":5856,"sourceCodeEnd":5892,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/apps/codex-plus-manager/src-tauri/src/commands.rs#L5856-L5892","documentation":"Thrown when spawning the platform `open` command (macOS) to launch the system browser for a URL fails. The library uses `std::process::Command::new(\"open\").arg(url).spawn()` on non-Windows platforms and maps any spawn error into this Chinese-language anyhow error. It indicates the OS could not start the `open` process.","triggerScenarios":"Calling the open-in-browser Tauri command on macOS/Linux; `Command::spawn` fails because the `open` binary is missing, PATH is wrong, or the OS refuses to exec (permissions, resource limits).","commonSituations":"Running on Linux where `/usr/bin/open` does not exist (Linux uses xdg-open), stripped/minimal container images without the open tool, or broken PATH for the GUI process.","solutions":["Verify the `open` binary exists (`which open`) and is on PATH for the app process","On Linux, branch to `xdg-open` instead of `open` (cfg(target_os) handling)","Check that the spawned Tauri process inherits a sane PATH environment","Fall back to printing the URL or using a crate like `open`/`webbrowser` that picks the right helper per platform"],"exampleFix":"// before\n#[cfg(not(windows))]\n{\n    std::process::Command::new(\"open\").arg(url).spawn()\n        .map(|_| ())\n        .map_err(|error| anyhow::anyhow!(\"启动系统浏览器失败：{error}\"))\n}\n// after\n#[cfg(target_os = \"macos\")]\nlet opener = \"open\";\n#[cfg(all(unix, not(target_os = \"macos\")))]\nlet opener = \"xdg-open\";\n#[cfg(not(windows))]\n{\n    std::process::Command::new(opener).arg(url).spawn()\n        .map(|_| ())\n        .map_err(|error| anyhow::anyhow!(\"启动系统浏览器失败：{error}\"))\n}","handlingStrategy":"fallback","validationCode":"// before calling\nlet ok = which::which(\"open\").is_ok() || which::which(\"xdg-open\").is_ok();","typeGuard":null,"tryCatchPattern":"// match on the anyhow error and fall back to showing the URL\nif let Err(e) = open_in_browser(url).await {\n    log::warn!(\"{e:#}; copying URL to clipboard instead\");\n    copy_to_clipboard(url);\n}","preventionTips":["Pick the platform opener (open vs xdg-open) explicitly","Ensure the GUI process PATH includes /usr/bin","Test browser-open on all target platforms"],"tags":["process-spawn","macos","platform-specific","browser"],"backgroundTag":"command-not-found","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"}