error CS0101 already contains a definition: duplicate plugin in Unreal Engine

The same plugin is installed twice. UnrealBuildTool compiles every module rules file of the project into a single C# assembly, so two copies of the same .Build.cs declare the same class twice and the build stops before compiling anything.

  • Blocking: the package fails
  • Build stage: UnrealBuildTool, ExitCode=8
  • Reproduced in our lab (UE 5.4.4 and 5.8.3)

Paste your log: find the cause in seconds Runs in your browser, nothing is uploaded.

What it looks like in your log

Excerpts from a reproduction in our lab (a test plugin, not a real product). Paths anonymized; line numbers are those of the original files.

Unreal Engine 5.4.4

Log.txt

C:\Projects\MyProject\Plugins\Copies\MyPlugin\Source\MyPlugin\MyPlugin.Build.cs(5,14): error CS0101: The namespace '<global namespace>' already contains a definition for 'MyPlugin'C:\Projects\MyProject\Plugins\Copies\MyPlugin\Source\MyPlugin\MyPlugin.Build.cs(7,9): error CS0111: Type 'MyPlugin' already defines a member called 'MyPlugin' with the same parameter typesTotal execution time: 1.47 secondsExpecting to find a type to be declared in a target rules named 'MyProjectEditorTarget'.  This type must derive from the 'TargetRules' type defined by UnrealBuildTool.Took 1.59s to run dotnet.exe, ExitCode=8UnrealBuildTool failed. See log for more details. (C:\Users\Dev\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+Program+Files+Epic+Games+UE_5.4\UBA-MyProjectEditor-Win64-Development.txt)AutomationTool exiting with ExitCode=8 (8)

ExitCode=8 is the final code of AutomationTool when UnrealBuildTool fails: the build stopped before the cook started. The cause is printed above, and in the UBA-*.txt file named in the message.

The line after CS0111, "Expecting to find a type to be declared in a target rules named ...", is only a consequence of CS0101.

Unreal Engine 5.8.3

Log.txt

C:\Projects\MyProject\Plugins\Copies\MyPlugin\Source\MyPlugin\MyPlugin.Build.cs(5,14): error CS0101: The namespace '<global namespace>' already contains a definition for 'MyPlugin'C:\Projects\MyProject\Plugins\Copies\MyPlugin\Source\MyPlugin\MyPlugin.Build.cs(7,9): error CS0111: Type 'MyPlugin' already defines a member called 'MyPlugin' with the same parameter typesExpecting to find a type to be declared in a target rules named 'MyProjectEditorTarget'.  This type must derive from the 'TargetRules' type defined by UnrealBuildTool.Result: Failed (RulesError)Total execution time: 2.25 secondsTrace written to file C:\Users\Dev\AppData\Local\UnrealBuildTool\Trace.uba with size 1.0kbTook 2.47s to run dotnet.exe, ExitCode=8UnrealBuildTool failed. See log for more details. (C:\Users\Dev\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+Program+Files+Epic+Games+UE_5.8\UBA-MyProjectEditor-Win64-Development.txt)AutomationTool exiting with ExitCode=8 (8)

ExitCode=8 is the final code of AutomationTool when UnrealBuildTool fails: the build stopped before the cook started. The cause is printed above, and in the UBA-*.txt file named in the message.

Why a duplicate plugin gives a C# error

UnrealBuildTool scans every subfolder of Plugins, backup copies included (for example Plugins/Old/MyPlugin). All the module rules it finds are compiled together, so two copies of MyPlugin.Build.cs declare the class MyPlugin twice: the C# compiler stops with CS0101, then CS0111 for its constructor.

No message says "duplicate plugin". The path at the start of the CS0101 line points to the second copy.

The first error is the cause

Right after CS0101, UnrealBuildTool reports "Expecting to find a type to be declared in a target rules named ...". It looks like another error but it is only a consequence: once the rules assembly fails to compile, no target can be found. Fix CS0101 and that line disappears.

On UE 4, a plugin present both in the project and in the engine was reported as "An item with the same key has already been added". Our lab has not reproduced that variant.

Common causes

  • A plugin folder was copied as a backup inside Plugins (for example Plugins/MyPlugin and Plugins/Old/MyPlugin): every subfolder of Plugins is scanned.
  • The same plugin exists in the project Plugins folder and in the engine Plugins folder.

How to fix it

  1. The error line starts with the path of the second copy: open that folder.
  2. Search the project Plugins folder (all subfolders) and Engine/Plugins (including Marketplace) for .uplugin files named like the plugin.
  3. Keep one copy only, preferably the one matching your engine version, and move the others outside the project.
  4. Delete Binaries and Intermediate of the project, regenerate project files and package again.

Questions

Which copy should I delete?

Keep the one that matches your engine version, usually in the project Plugins folder, and move the other one out of the project, not just into another subfolder of Plugins.

Does it fail during the cook?

No, earlier: UnrealBuildTool fails before compiling (ExitCode=8), so the cook never starts.

Can it be caught before cooking?

Yes, it can be checked before you start a cook: List .uplugin files and report duplicate plugin or module names.

Reports and sources

Decode your log

Paste your packaging log, or drop Log.txt with Cook-*.txt / UBA-*.txt. The analysis runs in your browser: the log is never uploaded.

Get notified when the in-editor plugin launches

The same decoder inside the Unreal Editor, with checks that catch these errors before you cook.