Engine crashes when building lighting (engine version 4.12.4)

Retrieve the super verbose logs from Swarm Agent following instructions in this page.

Swarm should not cause the editor to crash since it’s a separate program that handles the building process.

You may also want to follow notes in this page to see if Swarm is using the right ports. If not, you’ll want to correct this on your machine since this is not an issue with UE4 or Swarm but your machine and the ports that are free.