BigPizzaV3/CodexPlusPlus · error

无法启动 :

Error message

无法启动 {}:{error}

What it means

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).

Solutions

  1. Verify the companion executable exists at the configured path and reinstall/update if missing
  2. Ensure execute permissions (chmod +x) or unblock the binary on Windows
  3. Use an absolute path instead of a PATH-relative one
  4. Check antivirus/security software quarantine logs

Example fix

// before
spawn_companion(Path::new("./manager")) // missing
// after
chmod +x ./manager
spawn_companion(Path::new("/opt/codex-plus/manager"))
Defensive patterns

Strategy: try-catch

Validate before calling

fn can_spawn(path: &std::path::Path) -> bool {
    path.is_file()
        && #[cfg(unix)] {
            use std::os::unix::fs::PermissionsExt;
            std::fs::metadata(path).map(|m| m.permissions().mode() & 0o111 != 0).unwrap_or(false)
        }
        && #[cfg(not(unix))] { true }
}

Try / catch

match spawn_companion(&path) {
    Err(e) if e.to_string().starts_with("无法启动") => {
        eprintln!("Companion executable missing or blocked: {e}");
        // prompt reinstall
    }
    other => other?,
}

Prevention

When it happens

Trigger: open_or_activate_manager calls spawn_companion with a path whose target is missing (NotFound), lacks execute permission (PermissionDenied), or otherwise fails to spawn.

Common situations: The manager/companion binary was moved or uninstalled; app bundled with an incorrect relative path; Windows Defender blocking execution; missing +x on Linux/macOS.

Related errors


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

Appendix: source

Thrown at crates/codex-plus-core/src/install/mod.rs:305

                let detail = launch_result
                    .map(|status| status.to_string())
                    .unwrap_or_else(|error| error.to_string());
                anyhow::bail!("macOS Launch Services 无法启动 bundle {bundle_id}:{detail}");
            }
        }
    }

    let path = companion_binary_path(binary);
    let mut command = Command::new(&path);
    command.args(&args);
    #[cfg(windows)]
    {
        use std::os::windows::process::CommandExt;
        command.creation_flags(crate::windows_create_no_window());
    }
    command
        .spawn()
        .map_err(|error| anyhow::anyhow!("无法启动 {}:{error}", path.to_string_lossy()))?;
    Ok(path.to_string_lossy().to_string())
}

pub fn open_or_activate_manager() -> anyhow::Result<String> {
    #[cfg(target_os = "macos")]
    {
        let exe = std::env::current_exe().unwrap_or_else(|_| PathBuf::from("."));
        if let Some(bundle_id) = macos_companion_bundle_identifier_from_exe(&exe, MANAGER_BINARY) {
            let activated = Command::new("/usr/bin/open")
                .args(["-b", bundle_id])
                .status()
                .is_ok_and(|status| status.success());
            if activated {
                return Ok(format!("bundle:{bundle_id}"));
            }
        }
    }

View on GitHub (pinned to b1ed92e5e4)