Exit codes

What the exit codes of the v-* commands mean, and the error codes and HTTP statuses that REST API v2 answers with.

Written for ArcPanel 2.2

Every v-* command exits with 0 when it succeeds. When it fails, it prints Error: and the reason, writes the call to /var/log/arcpanel/error.log, and exits with one of the codes below. REST API v2 runs the same commands and reports the code by its name in error.code, with the HTTP status of the last column.

Command exit codes

Code Name Meaning HTTP in REST API v2
1 E_ARGS Arguments are missing 422
2 E_INVALID An argument has a wrong format or value, such as a user name with spaces 422
3 E_NOTEXIST The user, domain, database or other object does not exist 404
4 E_EXISTS The object exists already 409
5 E_SUSPENDED The object or its owner is suspended 403
6 E_UNSUSPENDED The object is not suspended, so it cannot be unsuspended 500
7 E_INUSE The object is in use, such as a package that users have or an IP address that domains use 409
8 E_LIMIT A limit of the package is reached 422
9 E_PASSWORD The password or the secret is wrong, or the password is not accepted 403
10 E_FORBIDEN The action is not allowed, for example by a policy of the server 403
11 E_DISABLED The service or feature is not installed or is turned off, such as mail on a web-only server 503
12 E_PARSING A configuration file or the output of a tool could not be read 500
13 E_DISK There is not enough disk space 500
14 E_LA The server is too busy: the load average is too high 503
15 E_CONNECT A connection failed, for example to a backup host, a DNS cluster host or Let's Encrypt 500
16 E_FTP An FTP transfer to a backup host failed 500
17 E_DB The database server refused the action or could not be reached 500
18 E_RRD The statistics graphs could not be updated 500
19 E_UPDATE An update or an install failed 500
20 E_RESTART A service failed to restart after the change; check its configuration and its log 500

E_FORBIDEN is spelled this way in the commands, as in HestiaCP; REST API v2 writes it E_FORBIDDEN.

In a script, test the code with $?:

v-add-web-domain alice example.com
case $? in
    0) echo "added" ;;
    4) echo "example.com exists already" ;;
    8) echo "alice has no web domains left in her package" ;;
    *) echo "failed" ;;
esac

REST API v2 error codes

A failed call answers {"error": {"code": "E_…", "message": "…"}}. Besides the names of the exit codes above, the API has codes of its own:

Code HTTP Meaning
E_UNAUTHENTICATED 401 The access key is missing, unknown or wrong
E_API_DISABLED 403 The API is off for this key, or the client's address is not allowed
E_FORBIDDEN 403 The role or a permission set of the key does not allow the call
E_NOTEXIST 404 No such object within the reach of the key
E_METHOD_NOT_ALLOWED 405 The path exists, but not with this HTTP method
E_GONE 410 The result of a task is no longer kept
E_VALIDATION 422 The request is invalid; fields names each wrong field
E_RATE_LIMIT 429 Too many requests; wait the seconds of the Retry-After header
E_SERVER 500 A command failed without an exit code, or the panel failed

Two statuses depend on the operation: file uploads and downloads answer 413 with E_LIMIT when a file is larger than the operation allows, and 507 with E_DISK when the panel has too little space to stage the data.

The REST API reference lists the operations, and the CLI commands reference the commands.

API v1

API v1, when it is turned on, answers with the exit code in the ArcPanel-Exit-Code header and the command's output in the body.

Last updated