BigPizzaV3/CodexPlusPlus · error

macOS open command is empty

Error message

macOS open command is empty

What it means

On macOS, launch_codex builds an `open` command via build_macos_open_command and then takes command.first() as the executable; if the built command vector is empty there is nothing to spawn, so this error is returned. It guards an internal invariant that the command builder always produces at least one element (usually "open").

Solutions

  1. Inspect build_macos_open_command to ensure it always starts with "open"
  2. Restore default launch settings so the standard `open` command is built
  3. File/fix the builder regression — this is normally unreachable in correct code

Example fix

// before (builder regression)
Vec::new()
// after
vec!["open".to_string(), app_dir.join("Codex.app").to_string_lossy().into_owned()]
Defensive patterns

Strategy: validation

Validate before calling

let command = build_macos_open_command(app_dir, debug_port, &launch_extra_args);
if command.is_empty() {
    return Err("launcher produced an empty command; report this bug".into());
}

Prevention

When it happens

Trigger: build_macos_open_command or build_macos_open_command_with_app returns an empty Vec — typically only from a builder bug or an app_dir/args configuration that collapses the command to nothing.

Common situations: Custom app-dir/launch-args code path modified the builder; developer regressed build_macos_open_command; unusual empty launch_extra_args handling.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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

Appendix: source

Thrown at crates/codex-plus-core/src/launcher.rs:957

                        }),
                    );
                    quit_macos_app_and_wait(app_dir).await?;
                    MacosCleanupPolicy::QuitIfNotPreviouslyRunning
                }
            };
            let command = if let Some(inspector_port) = native_menu_inspector_port {
                build_macos_open_command_with_native_menu_inspector(
                    app_dir,
                    debug_port,
                    inspector_port,
                    &launch_extra_args,
                )
            } else {
                build_macos_open_command(app_dir, debug_port, &launch_extra_args)
            };
            let executable = command
                .first()
                .ok_or_else(|| anyhow::anyhow!("macOS open command is empty"))?;
            let child = Command::new(executable)
                .args(&command[1..])
                .stdout(Stdio::null())
                .stderr(Stdio::null())
                .spawn()
                .context("failed to launch macOS Codex app")?;
            *self.child.lock().await = Some(child);
            if let Some(inspector_port) = native_menu_inspector_port {
                start_native_menu_localizer(inspector_port);
            }
            return Ok(CodexLaunch::Process {
                command,
                wait_strategy: ProcessWaitStrategy::ExternalWaitCommand,
                macos_cleanup_policy: Some(cleanup_policy),
            });
        }

        let command = if let Some(inspector_port) = native_menu_inspector_port {

View on GitHub (pinned to b1ed92e5e4)