Select to view content in your preferred language

ArcPy Bug?- Find closest facility ERROR 001156: could not write value '32768' to output field ORIG_FID

1739
7
07-27-2017 03:42 AM
WhereMatters
Frequent Contributor

I am unable to solve a closest facility problem in ArcGIS Desktop 10.2.2 with ArcPy using the sample code provided in help documentation.

I get this error:

ERROR: A geoprocessing error occurred.
ERROR 001156: Failed on input OID 32768, could not write value '32768' to output field ORIG_FID
Failed to execute (FeatureClassToFeatureClass).
An error occured on line 27
A geoprocessing error occurred.
ERROR 001156: Failed on input OID 32768, could not write value '32768' to output field ORIG_FID
Failed to execute (FeatureClassToFeatureClass).
Failed to execute (FindClosestFacilities).

It seems to me this is a bug with field mapping that is occurring internally. Its obvious that ORIG_FID should be a long int and it actually is short int. That is why we are seeing this exception at 32768.

I am using the San Francisco network dataset available in ArcGIS tutorial data, with some randomly generated facilities (about 100,000) over the area.

This is the code that throws the error.

import arcpy
from arcpy import env

try:
    # Check out the Network Analyst extension license
    arcpy.CheckOutExtension("Network")

    # Set environment settings
    env.workspace = r'C:\arcgis\ArcTutor\Network Analyst\Tutorial\SanFrancisco.gdb'
    env.overwriteOutput = True

    # Set local variables
    inNetworkDataset = r'C:\arcgis\ArcTutor\Network Analyst\Tutorial\SanFrancisco.gdb\Transportation\Streets_ND'
    inIncidents = r'D:\Sample data\sampledata.gdb\incident'
    inFacilities = r'D:\Sample data\sampledata.gdb\manholes_sf'
    outGeodatabase = r'D:\Sample data\sampledata.gdb'
    #outGeodatabase = "in_memory"
    outRoutes = "Routes"
    outDirections = "Directions"
    outClosestFacilities = "ClosestFacilities"
    measurement_units = "Meters"

    # Run FindClosestFacilities. Choose to find only the closest facility.
    arcpy.na.FindClosestFacilities(inIncidents, inFacilities, measurement_units,
                                    inNetworkDataset, outGeodatabase, outRoutes,
                                    outDirections, outClosestFacilities,
                                    Number_of_Facilities_to_Find=1)

    print "Script completed successfully"

except Exception as e:
    # If an error occurred, print line number and error message
    import traceback, sys
    tb = sys.exc_info()[2]
    print "An error occured on line %i" % tb.tb_lineno
    print str(e)‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos
7 Replies
DanPatterson_Retired
MVP Emeritus

You have identified the problem, you will have to delete that field, then re-add it with the appropriate dtype.  I suspect the demo was just for that purpose and wasn't designed to handle that many records in the first place.

0 Kudos
WhereMatters
Frequent Contributor

No Dan, we cannot delete that field as it is part of an intermediate feature class/table that gets generated during the solve process. It is saved in the geodatabase as "TempInput" only because the process crashed out. During normal runs, it gets created and deleted automatically. Only this time, since the process crashed, we see the TempInput featureclass remain in the output gdb.

0 Kudos
DanPatterson_Retired
MVP Emeritus

Flag it to support is pretty well the only recourse then.  You may want to inquire if this issue had been identified and fixed in more recent versions... I notice that you refer to arcmap 10.2.2 which according to the Product Life cycle has entered 'mature' support (never found a clear definition of that one) so upgrading may be the only option.

0 Kudos
George_Thompson
Esri Notable Contributor

Dan Patterson‌ here is the information on Mature Support: http://downloads2.esri.com/support/TechArticles/Product-Life-Cycle.pdf 

--- George T.
DanPatterson_Retired
MVP Emeritus

Thanks George... finally bookmarked!

0 Kudos
DanPatterson_Retired
MVP Emeritus
WhereMatters
Frequent Contributor

Thanks Dan,

Adding a screenshot of the bug report

0 Kudos