{"record":{"id":"a5fa90b78c509b43","repo":"BigPizzaV3/CodexPlusPlus","slug":"macos-open-command-is-empty","errorCode":null,"errorMessage":"macOS open command is empty","messagePattern":"macOS open command is empty","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/launcher.rs","lineNumber":957,"sourceCode":"                        }),\n                    );\n                    quit_macos_app_and_wait(app_dir).await?;\n                    MacosCleanupPolicy::QuitIfNotPreviouslyRunning\n                }\n            };\n            let command = if let Some(inspector_port) = native_menu_inspector_port {\n                build_macos_open_command_with_native_menu_inspector(\n                    app_dir,\n                    debug_port,\n                    inspector_port,\n                    &launch_extra_args,\n                )\n            } else {\n                build_macos_open_command(app_dir, debug_port, &launch_extra_args)\n            };\n            let executable = command\n                .first()\n                .ok_or_else(|| anyhow::anyhow!(\"macOS open command is empty\"))?;\n            let child = Command::new(executable)\n                .args(&command[1..])\n                .stdout(Stdio::null())\n                .stderr(Stdio::null())\n                .spawn()\n                .context(\"failed to launch macOS Codex app\")?;\n            *self.child.lock().await = Some(child);\n            if let Some(inspector_port) = native_menu_inspector_port {\n                start_native_menu_localizer(inspector_port);\n            }\n            return Ok(CodexLaunch::Process {\n                command,\n                wait_strategy: ProcessWaitStrategy::ExternalWaitCommand,\n                macos_cleanup_policy: Some(cleanup_policy),\n            });\n        }\n\n        let command = if let Some(inspector_port) = native_menu_inspector_port {","sourceCodeStart":939,"sourceCodeEnd":975,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/launcher.rs#L939-L975","documentation":"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\").","triggerScenarios":"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.","commonSituations":"Custom app-dir/launch-args code path modified the builder; developer regressed build_macos_open_command; unusual empty launch_extra_args handling.","solutions":["Inspect build_macos_open_command to ensure it always starts with \"open\"","Restore default launch settings so the standard `open` command is built","File/fix the builder regression — this is normally unreachable in correct code"],"exampleFix":"// before (builder regression)\nVec::new()\n// after\nvec![\"open\".to_string(), app_dir.join(\"Codex.app\").to_string_lossy().into_owned()]","handlingStrategy":"validation","validationCode":"let command = build_macos_open_command(app_dir, debug_port, &launch_extra_args);\nif command.is_empty() {\n    return Err(\"launcher produced an empty command; report this bug\".into());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Add a unit test asserting build_macos_open_command never returns an empty vec","Avoid mutating the command vector to empty via launch args handling","Treat an empty command as a builder bug, not a user configuration issue"],"tags":["macos","launcher","invariant"],"backgroundTag":"internal-invariant-violation","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"}