Show Navigation | Hide Navigation
You are here:
Geoprocessing tool reference > Tool errors and warnings

Understanding geoprocessing tool errors and warnings

Release 9.3
Last modified April 24, 2009
E-mail This Topic Printable Version Give Us Feedback

Print all topics in : "Tool errors and warnings"

Note: This topic was updated for 9.3.1.

Tools communicate with users using messages. More critically, error and warning messages provide users with the opportunity to learn from, and adjust to, any problems. At 9.3, errors and warnings returned from geoprocessing tools have been standardized. The error messages will provide a clear indication of the error, and provide means through use of a standardized error code, to obtain more information about the error.

Progress dialog with error code

When a tool provides an error or warning code, you can look up that code in the help to find a richer description of the error, and further information that can be used to understand and deal with the issue. While using the geoprocessing progress dialog, commandline, or in the results tab, help for a coded error or warning can be accessed by clicking on the link provided with the message.

Understanding the error code

Additional help resources

History Log Files

When a tool fails or generates an error, a standard error code and message are typically seen in the tool's progress dialog. Sometimes, there are internal system errors that may accompany the standard error code. These errors and warnings are not typically provided as they tend to provide minimal help in understanding the problem. However, in certain cases, these messages may provide additional leads into correcting and dealing with the cause of the error.

The standard error you see in the progress dialog and any additional internal system errors can be written to a log file. Writing to a log file is controlled by the 'Log geoprocessing operations to a log file'. For more information on activating the log file and how to read it, see history log files.

Using standard errors and warnings in scripts and script tools

The error codes returned by geoprocessing can also be used in your own scripts and script tools. Messages can be identifying by scanning the remaining Tool errors and warnings page for appropriate error and warning codes. Once you've identified an appropriate code, you need to make note of the error code and any information that needs to be included in the message (normally referenced as <value>).

You find yourself in a position where you would like to add one of the standard error codes to Python script. After scanning the error and warning message section, you identify ID code 000012 as the error code you would like to use. To add this error code to your script, you'll use the AddIDMessage method along with an argument identifying whether the message will be an error or a warning, the ID code of the message minus the leading zeroes, and any argument(s) shown as <value> in the message.

gp.AddIDMessage("Error", 12, "myvalue")

Using the AddIDMessage method

See the AddIDMessage method for more information.

The Python sample below checks to see if a feature class has been provided as input, and if not uses the AddIDMessage to return code 12 (000012: <value> already exists). The optional argument is used to substitute the feature class name into the message.

import arcgisscripting
import sys
gp = arcgisscripting.create(9.3)

inFeatureClass = gp.GetParameterAsText(0)
outFeatureClass =  gp.GetParameterAsText(1)

    # If the output feature class already exists, raise an error
    if gp.Exists(inFeatureClass):
        raise "OverWriteError"
        # Additional processing steps

except "OverwriteError":
    # Use message ID 12, and provide the output feature class
    #    to complete the message.
    gp.AddIDMessage("Error", 12, outFeatureClass)

Please visit the Feedback page to comment or give suggestions on ArcGIS Desktop Help.
Copyright © Environmental Systems Research Institute, Inc.