English

How To: Recover a corrupt shapefile

Summary

Instructions provided describe various ways to recover a corrupt shapefile. Common causes of shapefile corruption include:

  • A computer crash while saving edits
  • Adding illegal geometry, such as unclosed circles
  • Modifying the attribute table in another software, such as Microsoft Excel
It is beyond the scope of this document to list all causes of shapefile corruptions.
If one of the bulleted steps below fixes the shapefile, it is not necessary to perform the other steps. If the steps in this document do not salvage the shapefile, revert to the backup file.

Procedure

Select an option below. Back up the data before attempting these options.

  • Use the Check Geometry tool in ArcToolbox > Data Management Tools > Features. Problems with the data are reported while the tool is executing or in the output table. View the output table after execution. An empty table indicates that the tool found no bad geometry. If bad geometry is reported, use the Repair Geometry tool in the bullet below.
  • Run the Repair Geometry tool in ArcToolbox > Data Management Tools > Features. After running the Repair Geometry tool, go back and run Check Geometry again to make sure that all corrupt features have been removed. Rerun the Check Geometry and Repair Geometry tools as many times as required.
  • Export the data to a geodatabase, and copy it back to a new shapefile.
  • If the data is on a network drive, copy it to a local drive. If the data is on a local drive, copy it to the root of the primary drive; for example, C:\.
  • Check for illegal field names in the attribute table. Field names can only have ten characters. Field names must start with a letter. File names must not contain special characters, except for the underscore character. Generally speaking, spaces in shapefile names work in ArcGIS for Desktop; however, for testing purposes, rename the shapefile so it does not contain spaces.
  • Remove all index (spatial, attribute, and geocoding) projection and metadata files in Windows Explorer. That is, remove all files except the .shp, .dbf, and .shx files. Verify a copy of these files has been made before removing them.
  • Open the shapefile on another computer.
  • Open the shapefile with another version of the software. If it can be opened, attempt to save it as a new shapefile by exporting the selected features to a new shapefile or feature class.
  • Copy the data to a new feature class by using the simple data loader or by copying and pasting features in an ArcMap edit session. If the shapefile does not contain many features, copy and paste the features one at a time or in groups to determine if specific feature(s) may be corrupt. After each copy and paste operation, save the edits. Verify whether the problem has been resolved.
  • If the data is still not repaired, and the Check Geometry/Repair Geometry tools in options 1 or 2 above reported the feature IDs of the bad records, manually remove them in an editing session.
  • Perform a field calculation using the Field Calculator. The Field Calculator may stop on the corrupt record. To determine this, examine the attribute table of the corrupt shapefile. For example, if a shapefile with 1,000 records stops on the 750th record, either the 750th or 751st record may be corrupt. To delete the corrupt record, start an ArcMap edit session. Copy and paste all records except the suspected bad records to a new shapefile. Alternatively, manually delete the suspected bad records.
  • Export the shapefile to a geodatabase. Similar to the step above, if the export stops at a particular record, copy and paste all the records except the suspected bad ones to a new shapefile.
  • Delete all fields in the shapefile except the FID, Shape and one attribute field (shapefiles must have at least one attribute field). If the problem persists, add a new string field, and delete the last remaining attribute field. If the problem goes away, this indicates a problem with one of the fields. Revert to the backup shapefile and use a process of elimination to determine the corrupt field.
  • Use one of the utilities found in the Related Information section at the bottom of this page.

    The CleanShapefile utility is for ArcGIS 8.3 only.
Note:
These utilities are not supported by Esri Technical Support.
Note:
For the ShapeFile Repairer utility to work correctly, ensure the language setting of the computer matches the language used to create the shapefile.

Related Information