During one of the macOS updates (26.2?), Apple somehow introduced an ObjC exception that sometimes triggers when a new tab is created while in the tab overview. Swift CANNOT CATCH ObjC exceptions. Instant crash. This affected Ghostty as well as Electron (unrelated project).
The fix is equally crazy: write an ObjC wrapper around the crashy-function, catch it, and basically retry periodically. This is 100% an Apple bug, but the way it manifests and the fix required to workaround it is pretty gnarly.
Credit to everyone but me, I didn't do any research here, I only read the good work by others on this one (all visible in the refs).
Ref: https://github.com/ghostty-org/ghostty/commit/8b1e4c66d7eedbc9455e5e06c15b531945b1ccc3
Ref: https://github.com/electron/electron/issues/49819