When opening unity, we sometimes have the following log :
ArgumentException: An item with the same key has already been added. Key: Check Duplicate Bundle Dependencies
at System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x000c1] in <567df3e0919241ba98db88bec4c6696f>:0
at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in <567df3e0919241ba98db88bec4c6696f>:0
at UnityEditor.AddressableAssets.Build.AnalyzeRules.AnalyzeResultData.OnAfterDeserialize () [0x00005] in D:\jenkins\workspace\UHM\Library\PackageCache\com.unity.addressables@1.6.0\Editor\Build\AnalyzeRules\AnalyzeResultData.cs:31
When this happens, we usually have errors in the final build regarding adressables, as they are not all built. The build otherwise is built correctly.
Any idea what might cause that? We saw that just a couple days ago and itās hard to get what the cause might be as itās pretty random.
Weāre on Unity 2019.2.13f1, using Addressables 1.6.2
Ancient thread, but Iām seeing the same error and thereās not really any context to follow it. It occurs when doing a build from the Addressables Groups tab.
I would assume itās trying to tell me that maybe an asset exists in multiple bundles, but why not throw a warning up or something instead? It just falls on its face here.
Same issue. Unity 2019.4.18f and Addressables 1.16.19
I just was on 1.16.10 when I first got the error.
I had opened a project I hadnāt touched in a month. Added 4 new prefabs to an addressable group. Assigned their label and shorted their addressable name. Then clicked build and got this error.
Tried cleaning and rebuilding but it persisted.
I assumed it was something with the 4 new prefabs so I removed them and clicked build and I continue to get the error.
Looks like the last person to mess with the addressables was a teammate. Perhaps there is a clash in their setup versus mine?
I ended up closing unity. Cleaning the cache again. Then rebuilding. Now it works.
Had this issue myself on Addressables 1.18.16 this week. Seems to be the same as Dr-Nick had above. After removing all of the recently added Addressable entries and then adding them again, the error went away, but there were no duplicates listed in the Addressables Groups window, and the console didnāt give any specifics. It would be really great if there was a way to know which Addressables were being duplicated.
I get a similar issue although it doesnāt have anything to do with Addressable Assets. The error does say Iām missing a key.
The error I get. Iām not really sure whatās going on so any help would be appreciated!
/Applications/Unity/Hub/Editor/2021.2.2f1/Unity.app/Contents/il2cpp/build/deploy/il2cpp @ /Bee/artifacts/rsp/6827040134566167516.rsp
Error: IL2CPP error (no further information about what managed code was being converted is available)
System.ArgumentException: An item with the same key has already been added. Key: mscorlib
at System.Collections.Generic.Dictionary2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) at Unity.IL2CPP.DataModel.BuildLogic.CecilLoading.AssemblyCache.Populate(IEnumerable1 assemblies) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.DataModel/BuildLogic.CecilLoading/AssemblyCache.cs:line 33
at Unity.IL2CPP.DataModel.BuildLogic.CecilLoading.CecilAssemblyLoader.LoadDeferred(ReadOnlyCollection1 allAssemblyPaths, LoadParameters parameters) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.DataModel/BuildLogic.CecilLoading/CecilAssemblyLoader.cs:line 69 at Unity.IL2CPP.DataModel.BuildLogic.DataModelBuilder.Initialize(UnderConstruction2& systemAssembly) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.DataModel/BuildLogic/DataModelBuilder.cs:line 263
at Unity.IL2CPP.DataModel.BuildLogic.DataModelBuilder.Build() in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.DataModel/BuildLogic/DataModelBuilder.cs:line 49
at Unity.IL2CPP.AssemblyConversion.Phases.InitializePhase.Run(AssemblyConversionContext context) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP/AssemblyConversion/Phases/InitializePhase.cs:line 19
at Unity.IL2CPP.AssemblyConversion.Classic.ClassicConverter.Run(AssemblyConversionContext context) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP/AssemblyConversion.Classic/ClassicConverter.cs:line 11
at Unity.IL2CPP.AssemblyConversion.AssemblyConverter.ConvertAssemblies(AssemblyConversionInputData data, AssemblyConversionParameters parameters, AssemblyConversionInputDataForTopLevelAccess dataForTopLevel) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP/AssemblyConversion/AssemblyConverter.cs:line 30
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun () (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPlayerWindow.cs:179)
Experiencing a similar error as above in Unity 2020.3 when generating a Linux x86_64 IL2CPP build
Fatal error in Unity CIL Linker
System.ArgumentException: An item with the same key has already been added. Key: mscorlib
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at Unity.Linker.EngineStripping.EngineModuleResolver.Initialize(UnityLinkContext context, AssemblyDefinition unityEngineFacade, ModulesAssetFile modulesAssetFile)
at Unity.Linker.EngineStripping.EngineStrippingContext.Initialize(AssemblyDefinition unityEngineFacade)
at Unity.Linker.Steps.InitializeEngineStrippingStep.Process()
at Mono.Linker.Steps.BaseStep.Process(LinkContext context)
at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
at Unity.Linker.UnityPipeline.ProcessStep(LinkContext context, IStep step)
at Mono.Linker.Pipeline.Process(LinkContext context)
at Unity.Linker.UnityDriver.UnityRun(ILogger customLogger)
at Unity.Linker.UnityDriver.RunDriverWithoutErrorHandling(ILogger customLogger)
at Unity.Linker.UnityDriver.RunDriver()
stderr:
Simalar issue too. When Trying to build for WebGl, with wn empty project of Unity Editor 2021.3.1:
keep having āAn item with the same key has already been added. Key: mscorlibā
Building Library\Bee\artifacts\WebGL\ManagedStripped failed with output:
C:\Program Files\Unity\Hub\Editor\2021.3.1f1\Editor\Data\il2cpp\build\deploy\UnityLinker.exe --search-directory=C:/_ToBurn/_ProjMy/Unity/NGToolEMptyProject_Test/Temp/StagingArea/Data/Managed --out=Library/Bee/artifacts/WebGL/ManagedStripped --include-link-xml=C:/_ToBurn/_ProjMy/Unity/NGToolEMptyProject_Test/Temp/StagingArea/Data/Managed\TypesInScenes.xml --include-directory=C:/_ToBurn/_ProjMy/Unity/NGToolEMptyProject_Test/Temp/StagingArea/Data/Managed --dotnetprofile=unityaot-linux --dotnetruntime=Il2Cpp --architecture=EmscriptenJavaScript --platform=WebGL --use-editor-options --enable-engine-module-stripping --engine-modules-asset-file=C:/Program Files/Unity/Hub/Editor/2021.3.1f1/Editor/Data/PlaybackEngines/WebGLSupport/modules.asset --editor-data-file=C:/_ToBurn/_ProjMy/Unity/NGToolEMptyProject_Test/Temp/StagingArea/Data/Managed/EditorToUnityLinkerData.json --print-command-line
Fatal error in Unity CIL Linker
System.ArgumentException: An item with the same key has already been added. Key: mscorlib
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at Unity.Linker.EngineStripping.EngineModuleResolver.Initialize(UnityLinkContext context, AssemblyDefinition unityEngineFacade, ModulesAssetFile modulesAssetFile)
at Unity.Linker.EngineStripping.EngineStrippingContext.Initialize(AssemblyDefinition unityEngineFacade)
at Unity.Linker.Steps.InitializeEngineStrippingStep.Process()
at Mono.Linker.Steps.BaseStep.Process(LinkContext context)
at Unity.Linker.UnityPipeline.ProcessStep(LinkContext context, IStep step)
at Mono.Linker.Pipeline.Process(LinkContext context)
at Unity.Linker.UnityDriver.UnityRun(Boolean noProfilerAllowed, ILogger customLogger)
at Unity.Linker.UnityDriver.RunDriverWithoutErrorHandling(ILogger customLogger, Boolean noProfilerAllowed)
at Unity.Linker.UnityDriver.RunDriver()
UnityEngine.GUIUtility:processEvent (int,intptr,bool&)
Iām not quite sure what the cause of this issue is. You might be able to work around it by disabling the āStrip Engine Codeā option in the Player Settings though. Iām curious to see if that will allow it to build, or if it will lead to a different error message later.
By reinstalling Unity (2021.3.2) (No need to reinstall Unity Hub tho), it works for new empty project. But, i wont try again, to open a project that didnāt work, bcz it gonna make any project wonāt works any more. For Build WebGl