(Note: I originally mentioned this in bug#51993, but it's only somewhat-related to that bug. To make things easier to follow, I pulled this part out into a separate bug.) To see this in action: $ emacs -Q -f server-start $ emacsclient -c foo.txt ;; From the first (non-client) frame: C-x 5 0 ;; delete-frame ;; From the second (client) frame: M-x kill-emacs ;; Emacs prompts: Error (error Attempt to delete the sole visible or iconified frame); continue? (y or n) Pressing "y" will properly kill Emacs, but there's no real use for the warning in this case. It happens because 'server-force-stop' (indirectly) tries to delete the last (client) frame before killing Emacs, meaning that Emacs would have zero frames for a bit. Since 'server-force-stop's docstring says, "This function is meant to be called from `kill-emacs-hook'," it should be safe to have 'server-force-stop' avoid deleting any frames: they'll just get deleted when Emacs is actually killed. Attached is a patch to do this. Note that I named the new argument "noframe" because that matches the existing code in server.el (see 'server-delete-client'). It's a bit of a misnomer though, and maybe "keep-frames" would be better...