macOS application crashes on clicking app menu or the apple menu in macOS Sonoma

I have a macOS app made with the Electron framework. Ever since I updated to macOS Sonoma, I've been facing a random crash whenever I click on the app menu/apple menu. This is not reproducible but happens quite often. On checking the crash report, I can notice that nil is being provided as an input to __NSPlaceholderDictionary initWithObjects method, but this crash does not happen in macOS Ventura or older versions. Is this due to any new validation added to the above method in macOS Sonoma ?

Application Specific Backtrace 0:
0   CoreFoundation                      0x000000018c6c08c0 __exceptionPreprocess + 176
1   libobjc.A.dylib                     0x000000018c1b9eb4 objc_exception_throw + 60
2   CoreFoundation                      0x000000018c5d7fa4 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 728
3   CoreFoundation                      0x000000018c5d7ca0 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 52
4   AppKit                              0x000000019059d56c __NSSearchFieldCellGetSymbolImageDict_block_invoke + 3616
5   libdispatch.dylib                   0x000000018c3c1910 _dispatch_client_callout + 20
6   libdispatch.dylib                   0x000000018c3c314c _dispatch_once_callout + 32
7   AppKit                              0x000000019059c368 NSSearchFieldCellGetSearchImage + 596
8   AppKit                              0x000000018feea85c -[NSSearchFieldCell(NSSearchFieldCell_Local) _adjustSearchButtonCellImages::] + 216
9   AppKit                              0x000000018fff2364 -[NSSearchFieldCell initWithCoder:] + 1040
10  AppKit                              0x000000018fe6ed74 -[NSClassSwapper initWithCoder:] + 812
11  UIFoundation                        0x0000000191161a64 UINibDecoderDecodeObjectForValue + 668
12  UIFoundation                        0x00000001911617b0 -[UINibDecoder decodeObjectForKey:] + 312
13  AppKit                              0x000000018fe6f2f8 -[NSControl initWithCoder:] + 368
14  AppKit                              0x000000018fe6f744 -[NSTextField initWithCoder:] + 72
15  AppKit                              0x000000018fff1ef8 -[NSSearchField initWithCoder:] + 52
16  AppKit                              0x000000018fe6ed74 -[NSClassSwapper initWithCoder:] + 812
17  UIFoundation                        0x0000000191161a64 UINibDecoderDecodeObjectForValue + 668
18  UIFoundation                        0x0000000191161bec UINibDecoderDecodeObjectForValue + 1060
19  UIFoundation                        0x00000001911617b0 -[UINibDecoder decodeObjectForKey:] + 312
20  AppKit                              0x000000018fe30b6c -[NSView initWithCoder:] + 944
21  AppKit                              0x000000018fe6e804 -[NSCustomView initWithCoder:] + 76
22  UIFoundation                        0x0000000191161a64 UINibDecoderDecodeObjectForValue + 668
23  UIFoundation                        0x00000001911617b0 -[UINibDecoder decodeObjectForKey:] + 312
24  AppKit                              0x000000018fdfdecc -[NSNibConnector initWithCoder:] + 88
25  AppKit                              0x000000018fdfde1c -[NSNibOutletConnector initWithCoder:] + 336
26  UIFoundation                        0x0000000191161a64 UINibDecoderDecodeObjectForValue + 668
27  UIFoundation                        0x0000000191161bec UINibDecoderDecodeObjectForValue + 1060
28  UIFoundation                        0x00000001911617b0 -[UINibDecoder decodeObjectForKey:] + 312
29  AppKit                              0x000000018fdfceb8 -[NSIBObjectData initWithCoder:] + 136
30  UIFoundation                        0x0000000191161a64 UINibDecoderDecodeObjectForValue + 668
31  UIFoundation                        0x00000001911617b0 -[UINibDecoder decodeObjectForKey:] + 312
32  AppKit                              0x000000018fdfccd0 loadNib + 264
33  AppKit                              0x000000018fdfc34c +[NSBundle(NSNibLoading) _loadNibFile:nameTable:options:withZone:ownerBundle:] + 560
34  AppKit                              0x000000018fdfc050 -[NSBundle(NSNibLoading) loadNibNamed:owner:topLevelObjects:] + 180
35  Shortcut                            0x00000001cc34f6d4 -[SCTSearchManager loadNib] + 60
36  Shortcut                            0x00000001cc356bb8 -[SCTSearchManager akm_installShortcutView] + 200
37  Shortcut                            0x00000001cc3569b4 -[SCTSearchManager menuNeedsUpdate:] + 24
38  CoreFoundation                      0x000000018c640780 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148
39  CoreFoundation                      0x000000018c6d49a8 ___CFXRegistrationPost_block_invoke + 88
40  CoreFoundation                      0x000000018c6d48f0 _CFXRegistrationPost + 440
41  CoreFoundation                      0x000000018c60f434 _CFXNotificationPost + 764
42  Foundation                          0x000000018d700c74 -[NSNotificationCenter postNotificationName:object:userInfo:] + 88
43  AppKit                              0x0000000190445318 -[NSMenuTrackingSession sendBeginTrackingNotifications] + 204
44  AppKit                              0x00000001904495f4 -[NSMenuTrackingSession beginTrackingSession] + 184
45  AppKit                              0x00000001904ed170 -[NSMenuBarTrackingSession beginTrackingSession] + 188
46  AppKit                              0x00000001904ec1e4 -[NSMenuBarTrackingSession _mouseDownEventHandler:] + 128
47  AppKit                              0x00000001904ec14c -[NSMenuBarTrackingSession handleEvent:] + 248
48  AppKit                              0x00000001904ec02c __61-[NSMenuBarTrackingSession _addMouseDownEventMonitorIfNeeded]_block_invoke + 192
49  AppKit                              0x0000000190020624 _NSSendEventToDequeuingObservers + 252
50  AppKit                              0x00000001905f919c -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2260
51  AppKit                              0x000000018fe1843c -[NSApplication run] + 476
52  Electron Framework                  0x00000001128cefd0 _ZN8electron5fuses45IsLoadBrowserProcessSpecificV8SnapshotEnabledEv + 94056
53  Electron Framework                  0x00000001128cd4a0 _ZN8electron5fuses45IsLoadBrowserProcessSpecificV8SnapshotEnabledEv + 87096
54  Electron Framework                  0x0000000115494168 _ZN2v88internal20SetupIsolateDelegate13SetupBuiltinsEPNS0_7IsolateEb + 18052380
55  Electron Framework                  0x00000001154606ec _ZN2v88internal20SetupIsolateDelegate13SetupBuiltinsEPNS0_7IsolateEb + 17840800

I have a similar issue of an app crashing when pressing the application menu in Sonoma 14.1.2. In my case it's a Rosetta 2 app. Do you think it could be related?

Interesting to see there's a developer forum here, I haven't noticed it before.

macOS application crashes on clicking app menu or the apple menu in macOS Sonoma
 
 
Q