This specific error points to a bug in the Swift compiler. I have it happening on my app, with a handful of files, but intermittently. My build server has the same code checked out 5 times, with three checkouts building and the other two failing. I suspect once the file builds successfully and gets cached in Derived Data, the problem will go away until it is recompiled.
What you can do to identify the error is:
Click on "Command SwiftCompile failed with nonzero exit code" in the Issues navigator. This will open the build log, selecting the error.
Look at the file above it the error, in my case "Compiling ExtractedEvent.swift", which has a error indicator to the right and a grey exclamation point to the left.
Click on the four line hamburger icon on the far right side to open the output.
You should see something like:
SwiftCompile normal x86_64 Compiling\ ExtractedEvent.swift /path/to/file
cd ...
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
...
This means the compiler is broken and you should file the bug as directed.
What's working for me for now is to just keep hitting build until the error goes away.