# VSCodeProjectFileGenerator crashes with ArgumentOutOfRangeException for a project with no Modules entry 

**URL:** <https://forums.unrealengine.com/t/vscodeprojectfilegenerator-crashes-with-argumentoutofrangeexception-for-a-project-with-no-modules-entry/2745359>\
**Category:** Issues and Bug Reporting (Unreal Engine)\
**Tags:** unreal-engine\
**Created:** [August 20, 2026, 4:46pm UTC](https://forums.unrealengine.com/t/vscodeprojectfilegenerator-crashes-with-argumentoutofrangeexception-for-a-project-with-no-modules-entry/2745359 "2026-08-20T16:46:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mematoru](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mematoru](https://forums.unrealengine.com/u/Mematoru)\
**Post date:** [August 20, 2026, 4:46pm UTC](https://forums.unrealengine.com/t/vscodeprojectfilegenerator-crashes-with-argumentoutofrangeexception-for-a-project-with-no-modules-entry/2745359/1 "2026-08-20T16:46:00Z")

</div>

### Summary

VSCodeProjectFileGenerator crashes with ArgumentOutOfRangeException for a project whose .uproject has no “Modules” entry

### What Type of Bug are you experiencing?

Editor

### Steps to Reproduce

1. Take a project whose .uproject has no top-level “Modules” array (all its C++ comes from a plugin instead, a Marketplace/Fab plugin with native code). This means it also has no top-level Source folder. (Reproduced with the “Cropout” sample project + the AltTester plugin from the Marketplace.)
2. Run GenerateProjectFiles.sh (Mac) with: -project=“\<path-to-.uproject\>” -game -vscode
3. Generation proceeds through module discovery and indexing, then crashes during “Writing project files…”

For comparison: the same command against a project that DOES declare its own “Modules” entry (Epic’s “Project Titan” sample) succeeds normally on the same engine build.

### Expected Result

Project files generate successfully, the same as for a project that declares its own Modules array. A project that gets all its C++ from a plugin, with no module of its own, is a normal setup and shouldn’t crash generation.

### Observed Result

Generation crashes with an unhandled ArgumentOutOfRangeException right after “Writing project files… 50%”. Full output:

Unhandled exception: ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter ‘index’)  
at UnrealBuildTool.VSCodeProjectFileGenerator.WriteWorkspaceIgnoreFile(List`1 Projects)  
at UnrealBuildTool.VSCodeProjectFileGenerator.WritePrimaryProjectFile(ProjectFile UBTProject, PlatformProjectGeneratorCollection PlatformProjectGenerators, ILogger Logger)  
at UnrealBuildTool.ProjectFileGenerator.WriteProjectFiles(PlatformProjectGeneratorCollection PlatformProjectGenerators, ILogger Logger)  
at UnrealBuildTool.ProjectFileGenerator.GenerateProjectFiles(PlatformProjectGeneratorCollection PlatformProjectGenerators, String Arguments, ILogger Logger)  
at UnrealBuildTool.GenerateProjectFilesMode.ExecuteAsync(CommandLineArguments Arguments, ILogger Logger)  
at UnrealBuildTool.UnrealBuildTool.Main(String ArgumentsArray)

Result: Failed (OtherCompilationError)

Tried the same command on two different projects on the same unmodified UE 5.8 engine: the one without a Modules entry crashes every time, the one that has one (Project Titan) works every time.

### Affects Versions

5.8

### Platform(s)

Mac

### For crash reports, include your callstack

at UnrealBuildTool.VSCodeProjectFileGenerator.WriteWorkspaceIgnoreFile(List`1 Projects)  
at UnrealBuildTool.VSCodeProjectFileGenerator.WritePrimaryProjectFile(ProjectFile UBTProject, PlatformProjectGeneratorCollection PlatformProjectGenerators, ILogger Logger)  
at UnrealBuildTool.ProjectFileGenerator.WriteProjectFiles(PlatformProjectGeneratorCollection PlatformProjectGenerators, ILogger Logger)  
at UnrealBuildTool.ProjectFileGenerator.GenerateProjectFiles(PlatformProjectGeneratorCollection PlatformProjectGenerators, String Arguments, ILogger Logger)  
at UnrealBuildTool.GenerateProjectFilesMode.ExecuteAsync(CommandLineArguments Arguments, ILogger Logger)  
at UnrealBuildTool.UnrealBuildTool.Main(String ArgumentsArray)

### Additional Notes

Line 1665 in VSCodeProjectFileGenerator.cs (UE 5.8):

DirectoryReference WorkspaceRoot = bForeignProject ? Projects[0].BaseDir : Unreal.RootDirectory;

Projects only has entries for targets the project itself owns. If the .uproject has no “Modules” array, there’s no project-owned target, just a stub target UBT makes up on the fly to build the plugin’s code, so Projects is empty and Projects[0] throws.

Fix:

DirectoryReference WorkspaceRoot = (bForeignProject && Projects.Count \> 0) ? Projects[0].BaseDir : Unreal.RootDirectory;

Tested this on the project that was crashing and it generates fine now.
