Exception: sbt.TrapExitSecurityException thrown from the UncaughtExceptionHandler in thread "run-main-0"

The sbt.TrapExitSecurityException is an exception that is thrown from the UncaughtExceptionHandler in the "run-main-0" thread in Scala. This exception is typically encountered when using the Scala Build Tool (sbt) and indicates a security exception related to trapping exit signals.

When sbt runs your Scala application, it sets up an UncaughtExceptionHandler to handle any uncaught exceptions that occur in the application's threads. The TrapExitSecurityException is one such exception that can be thrown by this handler.

This exception is thrown when sbt detects an attempt to trap exit signals, such as System.exit(), which is generally not allowed in sbt-managed applications. The purpose of this restriction is to prevent the application from terminating abruptly, as sbt itself manages the application's lifecycle.

To resolve this issue, you should avoid trapping exit signals in your Scala code when using sbt. Instead, you should let sbt handle the application's termination. If you have any specific code that is causing this exception to be thrown, you may need to modify it accordingly.

If you need further assistance or have any other questions, please let me know.