Skip to content

OpenFileDialog crash on macOS 15.7.3 #5554

@jdotrjs

Description

@jdotrjs

Description

FileFilters make it possible to hard crash macos

To Reproduce

app.go

func (a *App) PickFile(title string, patterns string) (string, error) {
	homeDir, _ := os.UserHomeDir()
	opts := wruntime.OpenDialogOptions{
		Title:            title,
		DefaultDirectory: homeDir,
		Filters:          []wruntime.FileFilter{},
	}
	if patterns != "" {
		opts.Filters = []wruntime.FileFilter{{
			DisplayName: title,
			Pattern:     patterns,
		}}
	}
	return wruntime.OpenFileDialog(a.ctx, opts)
}

app.tsx

import './app.css';
import { h } from 'preact';
import { AppProvider } from './lib/AppContext';
import { PickFile } from './api/client';

export function App() {
  return (
    <AppProvider>
      <button class="btn" onClick={async () => { const p = await PickFile("test", ""); }}>
        Work
      </button>
      <button class="btn" onClick={async () => { const p = await PickFile("test", "busted;busted.exe"); }}>
        Crash
      </button>
    </AppProvider>
  );
}

Expected behaviour

File dialog should open for both buttons

Actual behavior

"Work" opens a file selection dialog

"Crash" ... does not:

INF | Serving assets from frontend DevServer URL: http://localhost:5173/
2026/06/08 19:01:00 INFO userConfigDir: /Users/jdotrjs/Library/Application Support err=<nil>
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001954f3a30 __exceptionPreprocess + 176
	1   libobjc.A.dylib                     0x0000000194fb6b90 objc_exception_throw + 88
	2   CoreFoundation                      0x000000019542430c -[__NSArrayM insertObject:atIndex:] + 1276
	3   repro-app                           0x0000000102d659b4 -[WailsContext OpenFileDialog:::::::::::] + 544
	4   repro-app                           0x0000000102d621f4 __OpenFileDialog_block_invoke + 164
	5   libdispatch.dylib                   0x00000001951dfb2c _dispatch_call_block_and_release + 32
	6   libdispatch.dylib                   0x00000001951f985c _dispatch_client_callout + 16
	7   libdispatch.dylib                   0x0000000195216b80 _dispatch_main_queue_drain.cold.5 + 812
	8   libdispatch.dylib                   0x00000001951eedb0 _dispatch_main_queue_drain + 180
	9   libdispatch.dylib                   0x00000001951eecec _dispatch_main_queue_callback_4CF + 44
	10  CoreFoundation                      0x00000001954c0b30 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
	11  CoreFoundation                      0x000000019548182c __CFRunLoopRun + 1980
	12  CoreFoundation                      0x00000001954809e8 CFRunLoopRunSpecific + 572
	13  HIToolbox                           0x00000001a0f2127c RunCurrentEventLoopInMode + 324
	14  HIToolbox                           0x00000001a0f244e8 ReceiveNextEventCommon + 676
	15  HIToolbox                           0x00000001a10af484 _BlockUntilNextEventMatchingListInModeWithFilter + 76
	16  AppKit                              0x00000001993a1a34 _DPSNextEvent + 684
	17  AppKit                              0x0000000199d40940 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 688
	18  AppKit                              0x0000000199394be4 -[NSApplication run] + 480
	19  repro-app                           0x0000000102d62d34 RunMainLoop + 40
	20  repro-app                           0x0000000102d5e774 _cgo_e58b8c1597c0_Cfunc_RunMainLoop + 20
	21  repro-app                           0x00000001023d9a2c runtime.asmcgocall.abi0 + 124
)
libc++abi: terminating due to uncaught exception of type NSException
SIGABRT: abort
PC=0x19535e388 m=0 sigcode=0
signal arrived during cgo execution

goroutine 1 gp=0x428f5a0ec1e0 m=0 mp=0x1035409c0 [syscall, locked to thread]:
runtime.cgocall(0x102d5e760, 0x428f5a305d28)
	/opt/homebrew/Cellar/go/1.26.2/libexec/src/runtime/cgocall.go:167 +0x44 fp=0x428f5a305cf0 sp=0x428f5a305cb0 pc=0x1023cfd34
github.com/wailsapp/wails/v2/internal/frontend/desktop/darwin._Cfunc_RunMainLoop()
	_cgo_gotypes.go:731 +0x2c fp=0x428f5a305d20 sp=0x428f5a305cf0 pc=0x102bf77dc
github.com/wailsapp/wails/v2/internal/frontend/desktop/darwin.(*Frontend).RunMainLoop(0x428f5a52a2a0)
	/Users/jdotrjs/go/pkg/mod/github.com/wailsapp/wails/v2@v2.12.0/internal/frontend/desktop/darwin/frontend.go:83 +0x20 fp=0x428f5a305d30 sp=0x428f5a305d20 pc=0x102bfac30
github.com/wailsapp/wails/v2/internal/frontend/devserver.(*DevWebServer).RunMainLoop(0x428f5a540510)
	<autogenerated>:1 +0x34 fp=0x428f5a305d50 sp=0x428f5a305d30 pc=0x102c9f124
github.com/wailsapp/wails/v2/internal/app.(*App).Run(0x428f5a52eaa0)
	/Users/jdotrjs/go/pkg/mod/github.com/wailsapp/wails/v2@v2.12.0/internal/app/app_dev.go:33 +0x7c fp=0x428f5a305dc0 sp=0x428f5a305d50 pc=0x102ca8f7c
github.com/wailsapp/wails/v2/pkg/application.(*Application).Run(0x428f5a4f3980)
	/Users/jdotrjs/go/pkg/mod/github.com/wailsapp/wails/v2@v2.12.0/pkg/application/application.go:73 +0x17c fp=0x428f5a305e60 sp=0x428f5a305dc0 pc=0x102cab41c
github.com/wailsapp/wails/v2.Run(0x428f5a204180)
	/Users/jdotrjs/go/pkg/mod/github.com/wailsapp/wails/v2@v2.12.0/wails.go:14 +0x34 fp=0x428f5a305ea0 sp=0x428f5a305e60 pc=0x102cab5e4
main.main()
	/Users/jdotrjs/Projects/repro-app/main.go:19 +0x3f0 fp=0x428f5a305f60 sp=0x428f5a305ea0 pc=0x102cae7e0
runtime.main()
	/opt/homebrew/Cellar/go/1.26.2/libexec/src/runtime/proc.go:290 +0x22c fp=0x428f5a305fd0 sp=0x428f5a305f60 pc=0x1023a10ec
runtime.goexit({})
	/opt/homebrew/Cellar/go/1.26.2/libexec/src/runtime/asm_arm64.s:1447 +0x4 fp=0x428f5a305fd0 sp=0x428f5a305fd0 pc=0x1023d9c34

Screenshots

No response

Attempted Fixes

Non, mostly a bunch a variations on the FileFilter contents to see what triggers the crash. I think it's more than one entry, e.g., ; usage.

System Details

# Wails
Version | v2.12.0


# System
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
| OS           | MacOS                                                                                                                       |
| Version      | 15.7.3                                                                                                                      |
| Branding     |                                                                                                                             |
| Go Version   | go1.26.2                                                                                                                    |
| Platform     | darwin                                                                                                                      |
| Architecture | arm64                                                                                                                       |
| CPU 1        | Apple M4 Pro                                                                                                                |
| CPU 2        | Apple M4 Pro                                                                                                                |
| GPU          | Chipset Model: Apple M4 Pro Type: GPU Bus: Built-In Total Number of Cores: 16 Vendor: Apple (0x106b) Metal Support: Metal 3 |
| Memory       | 48GB                                                                                                                        |
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

# Dependencies
┌────────────────────────────────────────────────────────────────────┐
| Dependency                | Package Name | Status    | Version     |
| Xcode command line tools  | N/A          | Installed | 2410        |
| Nodejs                    | N/A          | Installed | 22.15.0     |
| npm                       | N/A          | Installed | 10.9.2      |
| *Xcode                    | N/A          | Installed | 16.4 (16F6) |
| *upx                      | N/A          | Available |             |
| *nsis                     | N/A          | Available |             |
|                                                                    |
└───────────────────── * - Optional Dependency ──────────────────────┘

# Diagnosis
Optional package(s) installation details:
  - upx : Available at https://upx.github.io/
  - nsis : More info at https://wails.io/docs/guides/windows-installer/

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingMacOSv2

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions