Common Errors
Each RPC request can be successful or unsuccessful. In the first case the response frame contains a result object while in the second case it contains an error object as stated in the RPC Protocol page. Each error object has:
code
: number, code identifying the type of the errormessage
: string, description of the error
Here are listed all common errors that can be returned as a response to a request send to a Shelly device.
-103: INVALID ARGUMENT
This error is received when the parameters sent in the request do not match the ones specified by the method in the request. It has code -103.
Example:
Request invoking the method Switch.GetStatus with no parameters:curl -X POST -d '{"id":1, "method":"Switch.GetStatus"}' \
http://${SHELLY}/rpcResponse containing error -103: INVALID ARGUMENT:{
"id": 1,
"src": "shellypro4pm-f008d1d8b8b8",
"dst": "user_1",
"error": {
"code": -103,
"message": "Missing required 'id'"
}
}
-104: DEADLINE EXCEEDED
This error is received when a request has timed out. It usually is related to requests for fetching external resources by calling HTTP.GET or HTTP.POST in scripts. It has code -104
Example:
Shelly.call(
"http.get",
{ url: "http://httpbin.org/delay/10", timeout: 2 },
function (response, error_code, error_message) {
print(error_code, " ", error_message);
}
);
-104 http request timed out
## -105: NOT FOUND
This error is received when an instance specified in the request is not found. It has code **-105**.
> *Example:*
```bash title="Request invoking the method Input.GetConfig with invalid parameter id=7:"
curl -X POST -d '{"id":1, "method":"Input.GetConfig", "params":{"id":7}}' \
http://${SHELLY}/rpc
{
"id": 1,
"src": "shellypro4pm-f008d1d8b8b8",
"dst": "user_1",
"error": {
"code": -105,
"message": "Bad id=7"
}
}
-108: RESOURCE EXHAUSTED
This error is received when a required resource has reached its limit. For example, when you try to create 21 schedule jobs on one Shelly device (the limit is 20). This error has code -108.
Example:
Response containing error -108: RESOURCE EXHAUSTED:{
"id": 1,
"src": "shellypro4pm-f008d1d8b8b8",
"dst": "user_1",
"error": {
"code": -108,
"message": "Job limit reached"
}
}
-109: FAILED PRECONDITION
This error is received when a precondition for a requested action is not satisfied. For example, when you try to turn a switch on in a situation of overpower condition, or when a reboot has been scheduled and the device is shutting down. This error has code -109.
Example:
Response containing error -109: FAILED PRECONDITION:{
"id": 1,
"src": "shellypro4pm-f008d1d8b8b8",
"dst": "user_1",
"error": {
"code": -109,
"message": "Overtemp condition present"
}
}
-114: UNAVAILABLE
This error is received when a service is unavailable. The service can be internal - a sensor could be unreachable, or external. External services are - timezone information, firmware update or HTTP requests in Scripts.
Example:
Shelly.call(
"http.get",
{ url: "http://boodle17.com", timeout: 15 },
function (response, error_code, error_message) {
print(error_code, " ", error_message);
}
);
-114 HTTP connect error -1