Dissolve tool error: "Invalid field type" only in GP Service

1626
2
Jump to solution
04-04-2018 11:56 AM
MKF62
by
Occasional Contributor III

I'm running a python script as a GP service, this script works great when run in the IDE or when run from a toolbox in ArcMap, but I cannot run the tool once it's published in a geoprocessing service. The error I receive is when it hits a line that uses the dissolve tool. It says "Error 000308: Invalid field type". All the fields being used to dissolve are integers, strings, float, and GUID data types. It runs successfully when it's not a geoprocessing service, so I know the fields are of a valid data type. I think it has something to do with my use of in_memory workspaces, but from what I have read, using in_memory workspace is the best practice when creating a lot of intermediate data in a GP service. I don't think the program is running out of memory when dissolving either because it's only dissolving a max of 200 features (and more often than not, it's really dissolving 50 or less). 

In the non-GP service code:

try:
  #Intersect buffer with selected patches to evaluate appropriate access to protective cover
  intersect_result = arcpy.Intersect_analysis([[aa2PCPolys, 1], [pc_buffer, 2]], 'in_memory/pc_intersect')
except:
 intsctError = traceback.format_exc()
 arcpy.AddError(intsctError)
 sys.exit(1)

#Define fields by which to aggregate features in the intersect_result FC
dissolveFields = ['StateID', 'Point', 'PatchNum', 'IsDeveloped', 'CropTypeID', 'CropResidue', 'CnpyOver12', 'CnpyDecid',
                              'CnpyConif', 'ShrubCover', 'ShbHiStemsDens', 'GrassCover', 'ForbCover', 'FrbAsProtect', 'ForbSpecies',
                              'BareGround', 'HerbHeight', 'IsQuailHab', 'ObsvDate', 'FirstName', 'LastName', 'Overstory', 'Understory',
                              'OfficialQH', 'StatePoint', 'MonitoringPointID', 'Orig_OID', 'Imputation', 'WhereImpute', 'QHonImputedVals',
                              'ObsvType']

#Aggregate features (ERRORS OUT ON THIS LINE)
try:
  dislvIntersect = arcpy.Dissolve_management(intersect_result, 'in_memory/pc_dislvIntersect', dissolveFields)‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

 

Once it has been published as  GP service it replaces the in_memory stuff with ESRI variables:

try:
  #Intersect buffer with selected patches to evaluate appropriate access to protective cover
  intersect_result = arcpy.Intersect_analysis([[aa2PCPolys, 1], [pc_buffer, 2]], g_ESRI_variable_28)
except:
  intsctError = traceback.format_exc()
  arcpy.AddError(intsctError)
  sys.exit(1)

#Define fields by which to aggregate features in the intersect_result FC
dissolveFields = ['StateID', 'Point', 'PatchNum', 'IsDeveloped', 'CropTypeID', 'CropResidue', 'CnpyOver12', 'CnpyDecid',
                              'CnpyConif', 'ShrubCover', 'ShbHiStemsDens', 'GrassCover', 'ForbCover', 'FrbAsProtect', 'ForbSpecies',
                              'BareGround', 'HerbHeight', 'IsQuailHab', 'ObsvDate', 'FirstName', 'LastName', 'Overstory', 'Understory',
                              'OfficialQH', 'StatePoint', 'MonitoringPointID', 'Orig_OID', 'Imputation', 'WhereImpute', 'QHonImputedVals',
                              'ObsvType']
#Aggregate features (ERRORS OUT ON THIS LINE)
try:
   dislvIntersect = arcpy.Dissolve_management(intersect_result, g_ESRI_variable_29, dissolveFields)‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

This part of the python script is recursive, in that it will do this process many times on different selected features. I noticed from the error messages it went through it one full time, and then errored out on the second pass (see the first two messages in the picture, that message prints every time it starts a new pass). Does it have to do with overwriting issues maybe? I have arcpy.env.overwriteOutput = True set, but I don't know how that effects in_memory datasets.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
MKF62
by
Occasional Contributor III

The answer was that the GUID data type was causing an issue. I still needed to use this in my dissolve, so what I did was copy the GUID field to a new field of data type string, went through with the dissolve, and then copied the string field back to a GUID field.

View solution in original post

2 Replies
MKF62
by
Occasional Contributor III

The answer was that the GUID data type was causing an issue. I still needed to use this in my dissolve, so what I did was copy the GUID field to a new field of data type string, went through with the dissolve, and then copied the string field back to a GUID field.

Waan
by
Occasional Contributor

I ran into the same issue when generating Thiessen (Voronoi) polygons ... commenting here in case anyone is Googling a similar error message. Looks the gp creates geometry and then joins the full attributes back to the geometry as the final step. Doubtless other tools are adversely affected by the presence of a Global ID.

0 Kudos