"Unexpected Errors during the file conversion" or "foreign key constraint failed"

Product(s): WaterCAD, WaterGEMS, HAMMER, FlowMaster
Version(s): 08.11.04.58, 10.00.XX.XX
Area: Layout and Data Input

Problem

When attempting to open a model saved in an older version, one of the following errors occur:

”There were unexpected errors during the file-conversion….”

Or 

"19: foreign key constraint failed"

Solution - WaterGEMS/WaterCAD/HAMMER

This may indicate that the model is corrupt, or that the file is not actually a WaterGEMS, WaterCAD or HAMMER model.

If the file is a .MDB file, make sure it is not an Access Database file (unrelated to WaterGEMS/WaterCAD/HAMMER) and make sure it is not the intermediate Geodatabase file used with WaterGEMS for ArcMap integration (which is separate from the actual model database). If the file has an extension of .MDB and you have Microsoft Access, you can open the file in Access and examine the tables. If there are only tables corresponding to the element types like "junction", and no tables beginning with "HMI...", then the file is an ArcMap intermediate geodatabase.

If you are seeing the "foreign key constraint failed" error and you have determined that the file is indeed a model file, try the following:

1) Open the program, but don't open any model yet.

2) Go to File > Database Utilities > Compact Database

3) Select the .SQLITE file associated with the model in question, then choose the option to "Purge to save space"

4) Click OK, allow the operation to complete, then try reopening the model.

If the above does not help, please contact technical support to investigate likely database corruption: Forum | Service Request. Reference # 771218.

Solution - FlowMaster

This issue has been known to occur when upgrading a FlowMaster V8i or earlier model (which stores project data in a MDB file) to the CONNECT Edition (which stores project data in a SQLITE file). When FlowMaster CONNECT Edition tries to upgrade the database from Access MDB to SQLITE, if there are problems or corruption in the database, it can surface and present the error in question. The model may open without error in V8i.

To resolve this issue, try opening  the .FM8.MDB file in Microsoft Access. If you encounter an error right away, it is a good indication that there is corruption in the database. If asked to repair, confirm and proceed, dismissing any errors that appear. Then, try re-opening in FlowMaster CONNECT Edition. Once open, when you re-save, it will save in the new SQLITE format.

If this does not help or you do not have Microsoft Access, send the data files to Technical Support (for example post on our Forum).

In the case of FlowMaster, the "Unexpected Errors during the file conversion" error may also include a crash with the following details:

System.ApplicationException: Error in the application.

at Haestad.Framework.Application.DomainDatabaseFile.HandleMissingProjectFile(ProjectProperties app)
at Haestad.Framework.Application.ProjectFileBase.Open(ProjectProperties app)
at Haestad.Framework.Application.ProjectBase.Open(ProjectProperties app)
...

See Also

Error message 41303 "Cannot open report file" 

Error opening model : Not a Valid Haestad Methods File 

Anonymous
Recommended
Related