I have a shapefile that I cannot open in any open source Python libraries, including GDAL, Pyshp, Fiona, and Geopandas. The error message: Invalid length for entity 9164 is a GDAL error message and can be found in the source code: https://fossies.org/linux/gdal/ogr/ogrsf_frmts/shape/shpopen.c at lines 871 and 2121. Both sections indicate that the error occurs during the reading/handling of offsets in the .shx file. Here is the comment to the first section that the error message occurs at: Read the .shx file to get the offsets to each record in the .shp file
The really frustrating aspect of this issue is that the file can be viewed and edited in QGIS/ArcGIS with no issues.
If I open the shapefile in QGIS and then save it with a different name, I can open the new shapefile with all python libraries. Upon further investigation, if I use the new .shx file with the original set of shp files, the file also opens in Python. So somehow this is a corrupted .shx file. Any info would be helpful as I have my processes automated.