Where is the list of geoprocessing error codes?

4732
5
06-19-2019 03:29 PM
curtvprice
MVP Esteemed Contributor

Where did the documentation go for GP error codes? I can find them in the 10.2 help but not in the current help for Desktop or Pro.

I like to use arcpy AddIDMessage method because this allows you to link your Python Geoprocessing tool validation errors and tool errors directly to Esri's help information.

5 Replies
JoshuaBixby
MVP Esteemed Contributor

You will love Esri's answer, classic and BS.  See ArcGIS Pro tool reference—ArcGIS Pro | ArcGIS Desktop .

Click to expand the Appendices node and you'll see the topic about errors and warnings. Due to the number of error reference pages, they are not provided in a browsable format. Instead, enter a search query to find a particular error reference page.

DanPatterson_Retired
MVP Emeritus

Don't want to break any copyright stuff, but everything is there.

messages...? .... if you know th code range, you can make your own list and paper your walss

import numpy as np

from arcpy import gp

codes = np.asarray([(i, gp.getIDMessage(i)) for i in range(84000, 85000)])

vals = np.where(codes[:, 1] != '')[0]

messages = codes[vals]

messages[:3]  # ---- first 3 messages as an example
 
array([['84001', 'Reading Data....'],
       ['84002', 'Computing Results....'],
       ['84003', 'Writing Results to Output Feature Class....']],
      dtype='<U617')‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

sabbatical/pre-retirement explorations

curtvprice
MVP Esteemed Contributor

Here's my method. Ran this from ArcMap and Pro python.exe's to get the list. 

import arcpy
for k in range(999999):
    try:
        dsc = arcpy.GetIDMessage(k)
        if dsc:
            print("{:6d} {}".format(k, dsc))
    except:
        pass‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

The diff is kind of fun, note they have tried to be consistent so your error IDs will work with one code for both arcpys.

--- a/gpcodes_arcmap106.txt
+++ b/gpcodes_pro23.txt
-   203 %s Cannot contain representations
+   203 %s cannot contain representations
-   357 End type option invalid with the ArcView or ArcEditor license
+   357 End type option invalid with a Basic or Standard license
-   377 The Side type option is invalid with an ArcView or ArcEditor license
+   377 The Side type option is invalid with a Basic or Standard license
-   384 Cannot have more than 2 inputs with the ArcView or ArcEditor license
+   384 Cannot have more than 2 inputs with a Basic or Standard license
-   574 Python 2.7 is not installed.
+   574 Python is not installed.
-   707 Spatial reference of the tiling scheme does not match the spatial reference of the data frame
+   707 Spatial reference of the tiling scheme does not match the spatial reference of the map
...‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
DanPatterson
MVP Esteemed Contributor

Fixing the original formatting...

import numpy as np
from arcpy import gp

# ---- sample range, change as appropriate
strt = 84000
end_ = 85000

codes = np.asarray([(i, gp.getIDMessage(i)) for i in range(strt, end_)])
vals = np.where(codes[:, 1] != '')[0]
messages = codes[vals]messages[:3]

# ---- first 3 messages as an example
array([['84001', 'Reading Data....'],
       ['84002', 'Computing Results....'],
       ['84003', 'Writing Results to Output Feature Class....']],
	   dtype='<U617')‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

... sort of retired...
0 Kudos
curtvprice
MVP Esteemed Contributor

Here's a new way to do it, appropriate for the age of Python notebooks! Run this code in an interactive window or Python notebook:

 

gperr = []
for k in range(120000):
    try:
        dsc = arcpy.GetIDMessage(k)
        if dsc:
            gperr.append("{:6d} {}".format(k, dsc))
    except:
        pass
for k in range(999998,1000000,1):
    try:
        dsc = arcpy.GetIDMessage(k)
        if dsc:
            gperr.append("{:6d} {}".format(k, dsc))
    except:
        pass

def gpfind(txt="parameter", maxrec=100, use_regex=False):
    """Search for geoprocessing error code IDs"""
    import re
    rtxt = txt
    if not use_regex:
        # simple case-insensitive search supporting *
        rtxt = "{}".format(txt.replace("*",".*"))
    elist = [e for e in gperr if re.search(rtxt,e,re.I)]
    if len(elist) > maxrec or len(elist) == 0:
        print("{} gp errors match '{}'".format(len(elist), txt))
    else: 
        print("\n".join(elist))

 

Then you can do this:

 

>>> gpfind("map extent")
 87779 DataFrameObject: Error in setting map extent
>>> gpfind("parameter")
138 gp error messages match 'parameter'
>>> gpfind("*invalid value*")
   216 Cannot execute Pivot Table--invalid value field name
 60412 The value provided was an invalid value for an identifier authority.
>>> gpfind("*invalid*value*")
   216 Cannot execute Pivot Table--invalid value field name
   738 At least one statistical result was invalid (NaN).  Please check the VIF values to determine whether near perfect multicollinearity is present.
  1165 Features with invalid date/time values (only includes first 30): %1 = %2.
 60412 The value provided was an invalid value for an identifier authority.
 60436 A logon request contained an invalid logon type value.
 61246 The string contains an invalid X500 name attribute key, oid, value or delimiter.