Opening app on macOS 11 Big Sur from JavaFX application randomly fails with kLSNoExecutableErr

Tags: , , , ,

We have a desktop JavaFX application (well, TornadoFX) that downloads an archive, extracts another app from it and launches this app with macOS open command. Simplified kotlin code looks like:

ProcessBuilder(listOf("open", "/path/to/", "arg")).start()

This has worked for years on older versions of macOS (10.15 and earlier) but now with macOS 11 Big Sur launching the app sometimes succeeds and sometimes fails.

In the mac following error can be seen:

OSStatus _LSCopyApplicationNodeFromOpenState(LSOpenState *): Returning kLSNoExecutableErr because node is a directory but we failed to register with error -10814

We extended the logic to check if all the files are really there before launching the app, and the files existed.

There is an assumption that maybe Launch Services database is not updated fast enough.

Following ways of trying to log what might be happening, didn’t reveal any errors:

lsappinfo listen +all forever

log stream –debug –predicate ‘subsystem == “”‘

Does anybody have a clue if there is a way to avoid this behavior and to be always able to launch the app?


After a lot of research and debugging, what seem to have worked for us, was to force Launch Services to register the app in its database by executing command like:

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f /path/to/

and afterwards we could launch the app.

The idea for such solution was found in this answer.

Source: stackoverflow