Error opening existing model: "Parameter name: Index was out of range"

Product(s): SewerGEMS, SewerCAD, CivilStorm, StormCAD, WaterGEMS, WaterCAD, HAMMER
Version(s): 10.00.XX.XX, 08.11.XX.XX
Area:  Modeling

Error or Warning Message

When opening a model, the following error message occurs:

"Specified argument was out of the range of valid values. Parameter name: Index was out of range. Must be non-negative and less than the size of the collection. Actual value was 1."


"Argument Exception: Adding duplicate."

How to Avoid

The likely cause of the issue is a corruption in one of the model files. There are a few things that you can try to resolve the issue.

Option 1 - Compact the database

First, close the model, but leave the program open. Next, go to Tools > Database Utilities > Compact Database. Select the model's database file and click Open. A new dialog will open. Select the option to purge the database to save space.

Once this is completed. Try opening the model files again.

Option 2 - Move the model files to a new folder

This step can be useful if the corruption is in one of the output, report, or backup files. Browse to where the model is saved and create a new folder. Move just the starter file and the database file (.stsw and .stsw.sqlite) to the new folder. Once completed, open the model from the new location and see if the error occurs.

Note that you can also simply delete the output, report and backup files. However, sometimes it is a good idea to retain some backup files in case you have a catastrophic system crash and your primary files are impacted.

Option 3 - Import the database file

Sometimes the corruption is in the model's .stsw file. If so, this is not usually a major issue. Almost all of the model data is stored in the database file. The .stsw file has information on presentation (color coding and annotations), graphs, and the background file applied to the model. The rest of the model data is stored in the database file. For this reason, sometimes importing the database file into a new project can resolve the error.

To do this, go to File > Import > (product name) database. Select the database file associated with the model. The database will open in an new untitled worksheet. Note that the appearance (except color coding and backgrounds) will be the same as before, and all model data will be retained. Save this project and a new .stsw file will be created.