{"record":{"id":"1c8838a08d72f186","repo":"BigPizzaV3/CodexPlusPlus","slug":"error-1c8838","errorCode":null,"errorMessage":"无法启动 {}：{error}","messagePattern":"无法启动 (.+?)：(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/install/mod.rs","lineNumber":305,"sourceCode":"                let detail = launch_result\n                    .map(|status| status.to_string())\n                    .unwrap_or_else(|error| error.to_string());\n                anyhow::bail!(\"macOS Launch Services 无法启动 bundle {bundle_id}：{detail}\");\n            }\n        }\n    }\n\n    let path = companion_binary_path(binary);\n    let mut command = Command::new(&path);\n    command.args(&args);\n    #[cfg(windows)]\n    {\n        use std::os::windows::process::CommandExt;\n        command.creation_flags(crate::windows_create_no_window());\n    }\n    command\n        .spawn()\n        .map_err(|error| anyhow::anyhow!(\"无法启动 {}：{error}\", path.to_string_lossy()))?;\n    Ok(path.to_string_lossy().to_string())\n}\n\npub fn open_or_activate_manager() -> anyhow::Result<String> {\n    #[cfg(target_os = \"macos\")]\n    {\n        let exe = std::env::current_exe().unwrap_or_else(|_| PathBuf::from(\".\"));\n        if let Some(bundle_id) = macos_companion_bundle_identifier_from_exe(&exe, MANAGER_BINARY) {\n            let activated = Command::new(\"/usr/bin/open\")\n                .args([\"-b\", bundle_id])\n                .status()\n                .is_ok_and(|status| status.success());\n            if activated {\n                return Ok(format!(\"bundle:{bundle_id}\"));\n            }\n        }\n    }\n","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/install/mod.rs#L287-L323","documentation":"spawn_companion launches an external companion executable at `path` and wraps any std::process::Command spawn failure into this error, embedding the executable path and the OS error. Raised when the process could not even be started (not when it exits non-zero).","triggerScenarios":"open_or_activate_manager calls spawn_companion with a path whose target is missing (NotFound), lacks execute permission (PermissionDenied), or otherwise fails to spawn.","commonSituations":"The manager/companion binary was moved or uninstalled; app bundled with an incorrect relative path; Windows Defender blocking execution; missing +x on Linux/macOS.","solutions":["Verify the companion executable exists at the configured path and reinstall/update if missing","Ensure execute permissions (chmod +x) or unblock the binary on Windows","Use an absolute path instead of a PATH-relative one","Check antivirus/security software quarantine logs"],"exampleFix":"// before\nspawn_companion(Path::new(\"./manager\")) // missing\n// after\nchmod +x ./manager\nspawn_companion(Path::new(\"/opt/codex-plus/manager\"))","handlingStrategy":"try-catch","validationCode":"fn can_spawn(path: &std::path::Path) -> bool {\n    path.is_file()\n        && #[cfg(unix)] {\n            use std::os::unix::fs::PermissionsExt;\n            std::fs::metadata(path).map(|m| m.permissions().mode() & 0o111 != 0).unwrap_or(false)\n        }\n        && #[cfg(not(unix))] { true }\n}","typeGuard":null,"tryCatchPattern":"match spawn_companion(&path) {\n    Err(e) if e.to_string().starts_with(\"无法启动\") => {\n        eprintln!(\"Companion executable missing or blocked: {e}\");\n        // prompt reinstall\n    }\n    other => other?,\n}","preventionTips":["Install the companion next to the app and resolve it via absolute path","Re-verify paths after upgrades or reinstalls","Check antivirus quarantine when spawn failures appear on Windows"],"tags":["process-spawn","rust"],"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"}