Could not find definition for module when packaging in Unreal Engine
A plugin descriptor declares a module named in the error (referenced via a .uplugin file), but UnrealBuildTool cannot find any <Module>.Build.cs file for it. The build stops before compiling anything.
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
Creating makefile for MyProjectEditor (manifest 'C:\Projects\MyProject\Intermediate\Build\Manifest-1-MyProjectEditor-Win64-Development.xml' not found)Total execution time: 1.79 secondsCould not find definition for module 'MyModule', (referenced via default plugins -> MyPlugin.uplugin)Took 1.91s 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.
Unreal Engine 5.8.3
Log.txt
Could not find definition for module 'MyModule', (referenced via MyProjectEditor default plugins -> MyPlugin.uplugin)Result: Failed (RulesError)Total execution time: 3.85 secondsTrace written to file C:\Users\Dev\AppData\Local\UnrealBuildTool\Trace.uba with size 1.5kbTook 4.07s 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.
What the message means
Each .uplugin lists its modules. For every module, UnrealBuildTool needs a matching <Module>.Build.cs file in the plugin's Source folder. "Could not find definition for module" means the .uplugin names a module that has no such file.
The part in parentheses tells you who asked for it: "referenced via default plugins -> MyPlugin.uplugin" (UE 5.4) or "referenced via MyProjectEditor default plugins -> MyPlugin.uplugin" (UE 5.8) names the .uplugin to open.
In our lab, a plugin that declared a module without any rules file produced this message on UE 5.4.4 and 5.8.3, then ExitCode=8.
Typical situations
A plugin copied from another project or from an archive without its Source folder; binaries built for another engine version, so the engine tries to rebuild a module whose sources are missing; a module renamed in Source but not in the .uplugin, or the other way round.
Common causes
- A plugin copied without its Source folder (only Binaries), often taken from another project.
- Plugin binaries built for another engine version, so the engine wants to rebuild a module whose source is missing.
- A .uplugin edited by hand, with a module name that does not match the Source folder.
How to fix it
- Open the .uplugin named at the end of the error and find the module in the Modules list.
- Check that Source/<Module>/<Module>.Build.cs exists in that plugin.
- If the plugin is incomplete or built for another engine version, reinstall the full plugin for your exact engine version.
- If the module is not needed, remove it from the Modules list of the .uplugin.
- Delete Binaries and Intermediate of the project, regenerate project files and package again.
Questions
Is it the same as "Expecting to find a type to be declared in a module rules named"?
No. Here the rules file is missing entirely. In the other error, the file exists but the class inside has another name.
Can I just remove the module from the .uplugin?
Yes, if the plugin works without it, for example an editor-only module you do not use. Otherwise reinstall the complete plugin built for your engine version.
Can it be caught before cooking?
Yes, it can be checked before you start a cook: Check that every module listed in each enabled .uplugin has a matching .Build.cs file.