BigPizzaV3/CodexPlusPlus · error · anyhow::Error
macOS app did not exit before debug relaunch
Error message
macOS app did not exit before debug relaunch: {} What it means
Before a debug relaunch on macOS, the launcher asks the running app to quit (via a cleanup command) and then polls `is_macos_app_running` until a deadline (MACOS_DEBUG_TAKEOVER_WAIT_MS). If the app process is still alive after the timeout, relaunching would collide with the old instance, so the takeover is aborted with the app directory in the message.
Solutions
- Manually quit the running macOS app (Cmd+Q or `pkill` its process) and retry the debug relaunch
- Increase MACOS_DEBUG_TAKEOVER_WAIT_MS to give slow shutdowns more time
- Investigate why the cleanup command did not terminate the app (check run_macos_cleanup_command output/logs)
Example fix
// before const MACOS_DEBUG_TAKEOVER_WAIT_MS: u64 = 5_000; // after const MACOS_DEBUG_TAKEOVER_WAIT_MS: u64 = 30_000;
Defensive patterns
Strategy: retry
Validate before calling
// before relaunch, confirm the app is gone
if is_macos_app_running(app_dir).await {
eprintln!("app still running; quit it manually before debug relaunch");
} Try / catch
loop {
match quit_macos_app_and_wait(app_dir).await {
Ok(()) => break,
Err(e) if e.to_string().contains("did not exit") => {
attempt_force_quit(app_dir)?;
continue; // bounded retries
}
Err(e) => return Err(e),
}
} Prevention
- Quit the running app manually before starting a debug takeover
- Increase the takeover wait timeout on slow machines
- Check for quit-blocking dialogs or stuck processes before relaunch
- Poll is_macos_app_running with a generous deadline in scripts
When it happens
Trigger: Running the debug relaunch/takeover flow while the previously launched macOS app bundle at `app_dir` refuses to exit or takes longer than MACOS_DEBUG_TAKEOVER_WAIT_MS to terminate.
Common situations: App showing a quit-confirmation dialog or being stuck; app hung/crashed without exiting; another user/session running the same bundle; cleanup AppleScript/kill command failing silently; very short takeover wait timeout on a slow machine.
Related errors
- Native browser cleanup is still running; launcher was not…
- API 请求超时( 秒),本批未提交
- archived lookup task failed
- built-in Dream Skin theme cannot be deleted
- built-in Dream Skin theme is read-only
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/ffc8760c4bf90461.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/launcher.rs:3069
return Ok(());
};
let _ = Command::new(executable)
.args(&command[1..])
.stdout(Stdio::null())
.stderr(Stdio::null())
.status()
.await
.with_context(|| format!("failed to request macOS app quit for {}", app_dir.display()))?;
Ok(())
}
async fn quit_macos_app_and_wait(app_dir: &Path) -> anyhow::Result<()> {
run_macos_cleanup_command(app_dir, MacosCleanupPolicy::QuitIfNotPreviouslyRunning).await?;
let deadline = tokio::time::Instant::now()
+ std::time::Duration::from_millis(MACOS_DEBUG_TAKEOVER_WAIT_MS);
while is_macos_app_running(app_dir).await {
if tokio::time::Instant::now() >= deadline {
anyhow::bail!(
"macOS app did not exit before debug relaunch: {}",
app_dir.display()
);
}
tokio::time::sleep(std::time::Duration::from_millis(
MACOS_DEBUG_TAKEOVER_INTERVAL_MS,
))
.await;
}
let _ = crate::diagnostic_log::append_diagnostic_log(
"launcher.macos_existing_app_without_cdp_stopped",
serde_json::json!({
"app_dir": app_dir
}),
);
Ok(())
}
View on GitHub (pinned to b1ed92e5e4)