UE4.16 Win 64 / Lighting build failed. Swarm failed to kick off.

When trying to build lightmaps on specific levels in UE4.16 WIN64 I get the error message “Lighting build failed. Swarm failed to kick off. Compile Unreal Lightmass.”

I’m using the 4.16 version from the Epic and in other project lightmass works. The same project works fine in OSX.

Checking the swarm logs I see the following error:

**

6:52:47 PM: [Interface:OpenChannel] Error: System.IO.IOException: The process cannot access the file 'C:\Users\User\AppData\Local\UnrealEngine\4.16\Saved\Swarm\SwarmCache\AgentStagingArea\v1.FE56833672349CA473F61AE11F9E8440F5C0BE71.mtrlgz' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at NSwarm.FSwarmInterface.OpenChannel(String ChannelName, EChannelFlags ChannelFlags)

**

Any idea how to fix this?

I am using more copies of the same project, can the issue be linked to this?

Hi, Technically I was coping with the same issue for at least 2 weeks! but long story short, It is very simple. I just found the solution minutes ago! I’ve attached pictures below:

Picture 1: In solution explorer go and open “Programs” Roll-out.

Picture 2: Scroll down (to the very bottom) and find “UnrealLightmass (Visual Studio 2015)” then right click it and click on build!

Look, My visual studio is 2017, I don’t know why Visual Studio 2015 has shown up in parentheses! Maybe you don’t have that there. Just find “UnrealLightmass” and by the way in the very first try of mine I searched “UnrealLightmass” in Solution Explorer and tons of of that showed up in Solution Explorer, so don’t do that and just scroll down! :slight_smile:

Picture 3: If the build is successful then this will appear:
========== Build: 1 succeeded, 0 failed, 2 up-to-date, 0 skipped ==========
(Maybe 2 Up-to-date does not show up for you!)

Picture 4: Then go to UE4.16 again and I personally use first person so open it and hit BUILD then this will show up:

Oh I really love that loading points!!! :))

I’m not a Visual Studio expert sorry if my terminology of Visual Studio was not correct!

I’ve run into similar issues and it stems mainly from having duplicate assets in your scene.

To check this, you can open a simple level and place in two different assets. If it builds fine there, yet fails on your map it’s most likely having copies of assets. This happens because Unreal writes a cached version of the scene, and if it tries to build a cache for T_Dirt01 and a different uasset with the name T_Dirt01 it tries to write it to the same location, and that’s why it bugs out with the file access error.

If you comb through your map, and look for copies of Materials, Static Meshes and Textures. Try to delete and reference duplicates, or rename them if they simply share a common name like box_01. I’d recommend going into Window>Statistics in your level and it will list the names of various assets which might be causing the issue.

Hope that was helpful, good luck!

Do you know how to fix this in mac? I am not using visual studio.