Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Build Failed - file has already been registered with different contents.

Discussion in 'Web' started by SceneForgeStudio, Mar 1, 2023.

  1. SceneForgeStudio


    Feb 28, 2017
    I'm trying to build my project for WebGL and am getting the following error:

    Code (CSharp):
    1. Internal build system error. BuildProgram exited with code -2147024809.
    2. System.ArgumentException: Library/Bee/artifacts/csharpactions/ has already been registered with different file contents
    3.    at Bee.TundraBackend.TundraBackend.AddWriteTextAction(NPath file, String contents, String actionName, NPath[] filesThatMightBeIncluded)
    4.    at Bee.TundraBackend.TundraBackend.AddCSharpActionImpl(String actionName, NPath[] targetFiles, NPath[] inputs, Object argument, NPath[] targetDirectories, MethodInfo method)
    5.    at Bee.TundraBackend.TundraBackend.AddCSharpAction(String actionName, NPath[] targetFiles, NPath[] inputs, Action`1 csharpAction, NPath[] targetDirectories)
    6.    at WebGLPlayerBuildProgram.GzipMarker.Setup(NPath inputPath, NPath outputPath)
    7.    at WebGLPlayerBuildProgram.WebGLPlayer.SetupCompressAndMarkGzip(NPath input, NPath output)
    8.    at WebGLPlayerBuildProgram.WebGLPlayer.SetupCompression(NPath input, NPath output)
    9.    at WebGLPlayerBuildProgram.WebGLPlayer.SetupPostProcessBuildFile(NPath path)
    10.    at WebGLPlayerBuildProgram.WebGLPlayer.SetupPlayerExecutable()+MoveNext()
    11.    at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
    12.    at System.Collections.Generic.SparseArrayBuilder`1.ReserveOrAdd(IEnumerable`1 items)
    13.    at System.Linq.Enumerable.ConcatNIterator`1.LazyToArray()
    14.    at System.Linq.Enumerable.ConcatNIterator`1.ToArray()
    15.    at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
    16.    at PlayerBuildProgramLibrary.PlayerBuildProgramBase.RunBuildProgram()
    17.    at PlayerBuildProgramTypeWrapper.Run(String[] args)
    18.    at Program.Main(String[] args)
    19. UnityEditor.GenericMenu:CatchMenu (object,string[],int)
    I previously was able to build just fine, but I'm not sure what's changed. I tried updating and downgrading multiple times between versions with no luck. I'm currently using 2021.3.19.

    An empty project builds fine, so it's a problem with my project, but I don't know what, and the error isn't very helpful. I'm not sure how to debug this.

    I tried deleting the Bee folder, BuildCache folder, Library folder, both with no luck.
    I also tried removing the WebGL build module, reinstalling the Unity version I'm using, and still nothing worked.

    If I look at the Editor.log file, I can see the steps of building, and it does go through basically everything, but after the final step, it fails with that error.

    Any other ideas? I just started a new job that requires my project to build for WebGL, so this isn't a great start...

    I changed the compression format from GZip to Disabled out of curiosity, and now I'm getting a different error:

    Code (CSharp):
    1. Internal build system error. BuildProgram exited with code -2147024809.
    2. System.ArgumentException: You're trying to copy to WebGLBuilds/Build/d41d8cd98f00b204e9800998ecf8427e.js more than once. Previously from Library/Bee/artifacts/WebGL/build/debug_WebGL_wasm/build.framework.js and now from Library/Bee/artifacts/WebGL/build/debug_WebGL_wasm/build.worker.framework.js
    3.   at Bee.Core.CopyTool.Setup(NPath target, NPath from)
    4.   at WebGLPlayerBuildProgram.WebGLPlayer.SetupCompression(NPath input, NPath output)
    5.   at WebGLPlayerBuildProgram.WebGLPlayer.SetupPostProcessBuildFile(NPath path)
    6.   at WebGLPlayerBuildProgram.WebGLPlayer.SetupPlayerExecutable()+MoveNext()
    7.   at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
    8.   at System.Collections.Generic.SparseArrayBuilder`1.ReserveOrAdd(IEnumerable`1 items)
    9.   at System.Linq.Enumerable.ConcatNIterator`1.LazyToArray()
    10.   at System.Linq.Enumerable.ConcatNIterator`1.ToArray()
    11.   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
    12.   at PlayerBuildProgramLibrary.PlayerBuildProgramBase.RunBuildProgram()
    13.   at PlayerBuildProgramTypeWrapper.Run(String[] args)
    14.   at Program.Main(String[] args)
    15. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
    Last edited: Mar 1, 2023
  2. CodeSmile


    Apr 10, 2014
    Hopefully you didn't do that with the same project but copies of the original project. Especially when it comes to "downgrading" there is no such thing. This could easily destroy your project.

    If you actually did that, and don't have the original project (before any up/downgrading) in source control, you may want to try re-applying the project into a newly created Unity project and try building for WebGL after every step (ie adding assets, adding scripts, assigning references to scripts and so on). Hopefully that doesn't take more than a day.

    But first, and generally for WebGL builds, be sure to test with the latest tech stream ie 2022.2 too.

    And you could try resetting Project Settings and specifically Player settings to defaults, probably easiest to do by deleting the associated settings file. But as always: in a copy of the project.
  3. SceneForgeStudio


    Feb 28, 2017
    Attached is the editor.log file:
    Thank you for the suggestions!
    I've been using version control to always revert back to my pre-up/downgrade project, so no worries there.

    I did try with the latest tech stream, but still had the same issue, so I went back to LTS. That's why I think it's a project-specific thing :(

    I'll try resetting the Player Settings and see if that works, thank you!
  4. CodeSmile


    Apr 10, 2014
    Oh, also: check any non-Unity (code) assets you imported into the project whether they are compatible with WebGL. Maybe you can try removing some of the most potentially conflicting assets in a project copy, it doesn't matter if the build is usable, only whether you *can* make a build after that and if you can narrow down a suspect, try removing just that from another project copy, and if that makes the build succeed think about how you can work without that asset.
  5. SceneForgeStudio


    Feb 28, 2017
    I will definitely give that a try!

    I reset the project settings, and now I get the following error: Maybe something isn't set up correctly? I'm not sure how to fix it though.

    Code (CSharp):
    1. Internal build system error. BuildProgram exited with code -2147024809.
    2. Old commandline for WebGLBuilds/Build/WebGLBuilds.framework.js.unityweb:
    3.   -o "WebGLBuilds/Build/WebGLBuilds.framework.js.unityweb" -i "Library/Bee/artifacts/WebGL/build/debug_WebGL_wasm/build.worker.framework.js" --comment
    4.   "UnityWeb Compressed Content (brotli)"
    6. New commandline for WebGLBuilds/Build/WebGLBuilds.framework.js.unityweb:
    7.   -o "WebGLBuilds/Build/WebGLBuilds.framework.js.unityweb" -i "Library/Bee/artifacts/WebGL/build/debug_WebGL_wasm/build.framework.js" --comment
    8.   "UnityWeb Compressed Content (brotli)"
    9. System.ArgumentException: AddAction invocation conflicts with earlier invocation for "WebGLBuilds\Build\WebGLBuilds.framework.js.unityweb": commandLineArguments differ
    10. Previous AddAction was here:
    11. <stack trace disabled - set BEE_DEBUG to '1' to trace the source of a conflict>
    13.    at Bee.Core.Backend.<>c__DisplayClass36_0.<AddAction>b__2(String msg)
    14.    at Bee.Core.Backend.AddAction(String actionName, NPath[] targetFiles, NPath[] inputs, String executableStringFor, String[] commandLineArguments, Boolean supportResponseFile, Dictionary`2 environmentVariables, NPath[] rspAndBatchFiles, Boolean allowUnexpectedOutput, Boolean allowUnwrittenOutputFiles, Boolean banContentDigestForInputs, String[] allowedOutputSubstrings, NPath[] unavoidableOutputs, NPath[] targetDirectories, String[] sharedResources, Nullable`1 deleteOutputsBeforeRun, NPath[] filesThatMightBeIncluded, CachingMode cachingMode, NPath[] cachingInputIgnoreList, NPath profilerOutput, String responseFileSeparator)
    15.    at WebGLPlayerBuildProgram.WebGLPlayer.SetupCompressAndMarkBrotli(NPath input, NPath output)
    16.    at WebGLPlayerBuildProgram.WebGLPlayer.SetupCompression(NPath input, NPath output)
    17.    at WebGLPlayerBuildProgram.WebGLPlayer.SetupPostProcessBuildFile(NPath path)
    18.    at WebGLPlayerBuildProgram.WebGLPlayer.SetupPlayerExecutable()+MoveNext()
    19.    at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
    20.    at System.Collections.Generic.SparseArrayBuilder`1.ReserveOrAdd(IEnumerable`1 items)
    21.    at System.Linq.Enumerable.ConcatNIterator`1.LazyToArray()
    22.    at System.Linq.Enumerable.ConcatNIterator`1.ToArray()
    23.    at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
    24.    at PlayerBuildProgramLibrary.PlayerBuildProgramBase.RunBuildProgram()
    25.    at PlayerBuildProgramTypeWrapper.Run(String[] args)
    26.    at Program.Main(String[] args)
    27. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
    Last edited: Mar 1, 2023
  6. jukka_j


    Unity Technologies

    May 4, 2018
    In the log above, the existence of a file mentioned as "build.worker.framework.js" reads wrong. Such a file should not exist as part of the build pipeline anywhere.

    That is, there should be a file "build.framework.js", and additionally if C/C++ multithreading is enabled, there should also be a file "build.worker.js"; but there should never be a file "build.worker.framework.js".

    So the presence of that file where both ".worker" and ".framework" exist simultaneously as a suffix does immediately suggest some kind of a bug.

    Additionally the build lists ".unityweb" suffixes, so I presume the build options you have active are
    - Release build (as opposed to Development)
    - Native C/C++ multithreading enabled (this is disabled by default, I wonder if you were experimenting with WebGL multithreading in this project?)
    - Decompression Fallback enabled (this is also disabled by default)

    If you are still experiencing the issue, try to see if flipping any one (or more) of the above settings works around the issue?

    I tried to locally reproduce the issue, but wasn't able to set up the conditions to see the bug. If you are still seeing the problem, please submit a test repro project as a bug against Unity, so it should then get to the team's backlog to investigate.
  7. KamilCSPS


    May 21, 2020
    I am very sorry to pollute this thread with my comment as it doesn't add anything constructive but...

    @jukka_j - Hope everything is well! Happy to see you back posting on the forums. Welcome back and thank you for your continued contributions! :)