I’ve submitted a fix for this to a development stream, but it’s not visible on GitHub yet. We’ll include it in the 4.17.2 hotfix (we’ve already stopped taking changes for the 4.17.1 hotfix to try and get the other issue on this thread out of the door). The fix is to insert a check that the Instance.Modules list doesn’t already contain a module in the UEBuildTarget.AddPlugin function here (in Engine/Source/Programs/UnrealBuildTool/Configuration/UEBuildTarget.cs):
// Create modules for this plugin
UEBuildBinaryType BinaryType = ShouldCompileMonolithic() ? UEBuildBinaryType.StaticLibrary : UEBuildBinaryType.DynamicLinkLibrary;
if (Info.Descriptor.Modules != null)
{
foreach (ModuleDescriptor ModuleInfo in Info.Descriptor.Modules)
{
if (ModuleInfo.IsCompiledInConfiguration(Platform, TargetType, Rules.bBuildDeveloperTools, Rules.bBuildEditor, Rules.bBuildRequiresCookedData))
{
UEBuildModule Module = FindOrCreateModuleByName(ModuleInfo.Name, PluginReferenceChain);
// BEGIN PATCH
if(!Instance.Modules.Contains(Module))
{
// END PATCH
if (!Module.RulesFile.IsUnderDirectory(Info.Directory))
{
throw new BuildException("Plugin '{0}' (referenced via {1}) does not contain the '{2}' module, but lists it in '{3}'.", Info.Name, ReferenceChain, ModuleInfo.Name, Info.File);
}
Instance.bDescriptorNeededAtRuntime = true;
Instance.Modules.Add(Module);
// BEGIN PATCH
}
// END PATCH
}
}
}