Error in ModelBuilder: Error: Unable to open table. An item with the same key has already been added

  Applies To 
  Product(s): SewerCAD, SewerGEMS, StormCAD, CivilStorm,WaterGEMS, WaterCAD, HAMMER
  Version(s): CONNECT Edition, V8i
  Area:  Modeling
  Original Author: Scott Kampa, Bentley Technical Support Group

Error or Warning Message

When importing external data from a source files (Excel spreadsheet, Access database, shapefile, or Geodatabase) with ModelBuilder, or when syncing data out to a source files using ModelBuilder, the following error message is generated:

<Element Type> Error: "Unable to open table #####"

or

"An item with the same key has already been added"

How to Avoid

Option 1 

There are two issues here that cause similar problems. The first is a problem with the geometry of the geodatabase file being used, which throws this error message: "<Element Type> Error: "Unable to open table #####". This issue was resolved in defect 129363 for Select Series 5 of WaterGEMS/WaterCAD/HAMMER. You can use the following link for downloading the latest patch set for the software from the Bentley website. 

The second can occur when there are duplicate item labels being used in the 'Key Field' of ModelBuilder or can occur due to the geometry of the file. The "An item with the same key has already been added" can occur in the first step or after the fifth step. Make sure that the item labels being used in the 'Key Field' are unique. If there is no unique field, there will be a field called "<label>" in ModelBuilder. This is generated by the program and can be used as the 'Key Field' as needed. Note that you will not be able to sync data back to the source file if you use "<label>" as the 'Key Field', since this field is not available in the source file itself. This can also occur whether there are duplicate labels in the geodatabase file or what 'Key Field' type is used (GIS-ID or Label). In addition, check the source file for bad data, such as pipe lengths that are listed as being zero.

Option 2

Open the shapefile in ArcMap and right click on it  2) Choose Data > Export Data > Name the file and click Ok. This will create a new copy of the shapefile with the same coordinates as the other file.    

Option 3

Open the shapefile in ArcMap and run the "Repair Geometry" tool located in the Data Management ArcToolbox (ArcToolbox > Data Management > Features > Repair Geometry). Once this is completed, try the shapefile in ModelBuilder again.

Note that you can also run the Check Geometry option to see if there are potential issues that will need repair first.

Option 4

If you are syncing the model out to update a source file, this issue can occur if the geometry of the pipes in the model is such that the length is zero. While a model will typically not compute with invalid pipe length or diameter data, importing a model with this information through ModelBuilder can be allowed. In order to resolve this, either valid data should be in the model, or the elements with the invalid data should not be included in the export.

See Also

Using ModelBuilder to Import External Data

  • Created by Bentley Colleague
  • When: Tue, Feb 24 2015 3:04 PM
  • Last revision by Bentley Colleague
  • When: Wed, Apr 22 2020 8:04 AM
  • Revisions: 13
  • Comments: 0
Recommended
Related