API Return Codes

Note: In some shell environments, return codes above 255 may be returned modulo 256. This can, in particular, cause service return codes (which range from 4000 upward) to be mistaken for (possibly) non-existant common STAF return codes. For example, if a service returned the return code 4010, this might appear to be the return code 170 (4010 modulo 256) in a shell environment.

Table 1. STAF API Return Codes
Error Code Meaning Comment
0 No error
1 Invalid API This indicates that a process has tried to call an invalid internal STAF API. If this error occurs, report it to the authors.
2 Unknown Service You have tried to submit a request to a service that is unknown to STAFProc. Verify that you have correctly registered the service.
3 Invalid Handle You are passing an invalid handle to a STAF API. Ensure that you are using the handle you received when you registered with STAF.
4 Handle already exists This indicates that you are trying to register a process with one name when that process has already been registered with a different name. If you register the same process multiple times, ensure that you use the same name on each registration call.

Note: If you receive this error code when trying to perform an operation other than registering a service, report it to the authors.

5 Handle does not exist You are trying to perform an operation on a handle that does not exist. For example, you may be trying to stop a process, but you are specifying the wrong handle.
6 Unknown Error An unknown error has occurred. This error is usually an indication of an internal STAF error. If this error occurs, report it the authors.
7 Invalid Request String You have submitted an improperly formatted request to a service. See the appropriate section in this document for the syntax of the service's requests, or contact the provider of the service.

Note: Additional information regarding the exact syntax error may be provided in the result passed back from the submit call.

8 Invalid Service Result This indicates an internal error with the service to which a request was submitted. If this error occurs, report it to the authors and the service provider.
9 Rexx Error This indicates an internal error in an external Rexx service. If this error occurs, report it to the authors and the service provider.

Note: The actual Rexx error code will be returned in the result passed back from the submit call.

10 Base OS Error This indicates that a base operating system error was encountered.

Note: The actual base operating system error code will be returned in the result passed back from the submit call.

11 Process Already Complete You are trying to perform an invalid operation on a process that has already completed. For example, you may be trying to stop the process or register for a process end notification.
12 Process Not Complete You are trying to free process information for a process that is still executing.
13 Variable Does Not Exist You are trying to get, remove, or resolve a variable that does not exist. Remember that variables are case sensitive. The name of the variable that does not exist will be in the result passed back from the submit call.
14 UnResolvable String You have requested to resolve a string that cannot be resolved. This indicates that you have exceeded the resolution depth of the VAR service. The most common cause of this is recursive variables definitions.
15 Invalid Resolve String The string you requested to be resolved has a non-matching left or right curly brace. Ensure that all variable references have both left and right curly braces.
16 No Path To Machine This indicates that STAFProc was not able to submit the request to the requested machine. This error usually indicates that you have not configured any network interfaces, or that STAF is not running on the target machine. Alternatively, you may need to increase your CONNECTTIMEOUT value and/or increase your CONNECTATTEMPTS value in your STAF.cfg file
17 File Open Error This indicates that there was an error opening the requested file. Some possible explanations are that the file/path does not exist, contains invalid characters, or is locked.

Note: Additional information regarding which file could not be opened may be provided in the result passed back from the submit call.

18 File Read Error This indicates that there was an error while trying to read data from a file.

Note: Additional information regarding which file could not be read from may be provided in the result passed back from the submit call.

19 File Write Error This indicates that there was an error while trying to write data to a file.

Note: Additional information regarding which file could not be written to may be provided in the result passed back from the submit call.

20 File Delete Error This indicates that there was an error while trying to delete a file or directory.

Note: Additional information regarding which file or directory could not be deleted may be provided in the result passed back from the submit call.

21 STAF Not Running This indicates that STAF is not running on the local machine. Verify that STAFProc.exe is running.
22 Communication Error This indicates an error transmitting data across the network, or to the local STAF process. For example, you would receive this error if STAFProc.exe was terminated in the middle of a service request, or if a bridge went down in the middle of a remote service request.
23 Trustee Does Not Exist You have requested to delete a trustee, and the trustee does not exist. Verify that you have specified the correct trustee.
24 Invalid Trust Level You have attempted to set a machine or default trust level to an invalid level. The valid trust levels are from zero to five.
25 Insufficient Trust Level You have submitted a request from a machine which does not have the required trust level to perform the request.
26 STAF Registration Error This indicates that an external service encountered a problem when trying to register with STAF. Ensure that STAF has been properly installed and configured.
27 Service Configuration Error This indicates an error with the configuration of an external service. If this error occurs, report it the authors.
28 Queue Full This indicates that you are trying to queue a message to a handle's queue, but the queue is full. The maximum queue size can be increased by using the MAXQUEUESIZE statement in the STAF Configuration File.
29 No Queue Element This indicates that you tried to GET or PEEK a particular element in a queue, but no such element exists, or the queue is empy.
30 Notifiee Does Not Exist This indicates that you are trying to remove a message notification for a machine/process/priority combination which does not exist in the notification list.
31 Invalid API Level This indicates that a process has tried to call an invalid level of an internal STAF API. If this error occurs, report it to the authors.
32 Service Not Unregisterable This indicates that you are trying to unregister a service that is not unregisterable. Note that internal services are not unregisterable.
33 Service Not Available This indicates that the service you requested is not currently able to accept requests. The service may be in the process of initializing or terminating.
34 Semaphore Does Not Exist This indicates that you are trying to release, query, or delete a semaphore that does not exist.
35 Not Semaphore Owner This indicates that you are trying to release a semaphore for which your process is not the current owner.
36 Semaphore Has Pending Requests This indicates that you are trying to delete either a mutex semaphore that is currently owned or an event semaphore that has waiting processes.
37 Timeout This indicates that you submitted a request with a timeout value and the request did not complete within the requested time.
38 Java Error This indicates an error performing a Java native method call. A description of the error will be returned in the result passed back from the submit call.
39 Converter Error This indicates an error performing a codepage conversion. The most likely cause of this error is that STAF was not properly installed. However, it is possible that you are currently using a codepage that was not present or specified during STAF installation.
40 Service Already Exists This indicates that the specified Service already exists.

Note: Additional information regarding the service which already exists may be provided in the result passed back from the submit call.

41 Invalid Object This indicates that an invalid object was specified to a STAF API. If you receive this return code via a standard STAFSubmit call, report it to the authors and the service provider.
42 Invalid Parm This indicates that an invalid parameter was specified to a STAF API. If you receive this return code via a standard STAFSubmit call, report it to the authors and the service provider.
43 Request Number Not Found This indicates that the specified Request Number was not found. The specified Request Number may be invalid, or the request's information may no longer be available from the Service Service (for example, if the SERVICE FREE command had previously been issued for the request number).
44 Invalid Asynch Option This indicates that an invalid Asynchronous submit option was specified.
45 Request Not Complete This indicates that the specified request is not complete. This error code would be returned, for example, if you requested the result of a request which has not yet completed.
46 Process Authentication Denied This indicates that the userid/password you specified could not be authenticated. The userid/password may not be valid or authentication may be disabled.
47 Invalid Value This indicates that an invalid value was specified. This is closely related to the Invalid Request String return code, but indicates that a specific value in the request is invalid. For example, you may not have specified a number where a number was expected.

Note: Additional information regarding which value is invalid may be provided in the result passed back from the submit call.

48 Does Not Exist This indicates that the item you specified does not exist.

Note: Additional information regarding which item could not be found may be provided in the result passed back from the submit call.

49 Already Exists This indicates that the item you specified already exists.

Note: Additional information regarding which item already exists may be provided in the result passed back from the submit call.

50 Directory Not Empty This indicates that you have tried to delete a directory, but that directory is not empty.

Note: Additional information specifying the directory which could not be deleted may be provided in the result passed back from the submit call.

51 Directory Copy Error This indicates that you have tried to copy a directory, but errors occured during the copy.

Note: Additional information specifying the entries which could not be copied may be provided in the result passed back from the submit call.

52 Diagnostics Not Enabled This indicates that you tried to record diagnostics data, but diagnostics have not been enabled. You must enable diagnostics before you can record diagnostics data.
4000+ Service Defined Error codes of 4000 and beyond are service specific error codes. Either see the appropriate section in this document for the syntax of the service's requests, or contact the provider of the service.