Swarm failed to kick off. The process cannot access the file

1:45:25 PM: [Interface:TryOpenConnection] Local connection established
1:45:25 PM: [Job] Accepted Job 8D6ABE68-455CF99C-92AF0D89-03B3A6BA
1:46:09 PM: [Interface:OpenChannel] Error: System.IO.IOException: The process cannot access the file ‘C:\Users\AppData\Local\UnrealEngine\4.12\Saved\Swarm\SwarmCache\AgentStagingArea\8487AD2E5DBA413C81373D29B2915895.60728AFB41F824FC708C43B616C1C371.mtrlgz’ because it is being used by another process.
at.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)

101212-2016-08-03_13-52-19.jpg

I have already tried the suggestions/solutions posted on similar question threads -

  1. Clearing swarm directory
  2. Swarm Cache/ validation
  3. Copying the whole level into another empty level (without lights and with lights) - tried both options

As I am sure this error is related to materials, deleting all materials from the scene resolves the issue instantly.

But problem with my scene is that I have 1605 materials applied to 9147 actors and it’s becoming really hard to pin point the problem causing material. Tried deleting few 100 of materials but it didn’t resolves the problem.

I was wondering if there is any way to find the material through swarm ‘8487AD2E5DBA413C81373D29B2915895.60728AFB41F824FC708C43B616C1C371.mtrlgz

It would be very helpful to know any method/procedure to pin point the culprit material without randomly deleting and testing the scene.

Hi , are you the same from rag3dviz ??? i LOVE your work, big fan here. i tried the suggestions/solutions posted on similar questions threads too, and what worked for me was finding duplicate materials in the content browser and delete and replace, use filters and be patient. hope it works.

1 Like

Doing as Brito suggests does actually work… eventually. I just waded thru >1000 material instances removing duplicates. It was painful but stick at it and your lighting will build again. :slight_smile:

1 Like

Thanks for your answer. It fixed the problem for me after I removed duplicated materials and crucially for me material instances.

As mentioned above this is likely due to a duplicate material. As asinine as it is that lightmass can’t bake without every material having a unique name it is true. Go into your content browser, select the top most folder, filter by materials and then click on view options and switch to columns. Much easier to find the dupes that way

I had this problem for the last week or so. Thanks for sharing the solution! Deleting duplicated materials did the trick.

Just dropped by to see that this did indeed work for me with UE 4.20.3 as well. Found 2 instances of the engine’s starter content M_Metal_Chrome, deleted the other one and it started working as soon as I did so

I had this issue, and to solve it I had to ungroup some meshes and brushes.

I had this issue, and to solve it I had to ungroup some meshes and brushes.

To make this process easier you can find which textures and materials are duplicates by looking in your output log when the light build fails. It will list out the materials and textures it cannot open a channel for. You can then just search for those ones.

I can’t believe that; 1. I actually tried this and 2. that it actually worked. Geez…