Error codes
A failed request gets {"janus":"error","error":{"code":N,"reason":"..."}}. The codes are the ones of the C server (apierror.h). The reason strings follow the C server's too; the replay scenarios check them for every code they provoke.
| Code | Name | Raised when |
|---|---|---|
| 403 | Unauthorized | Wrong or missing apisecret, token or admin_secret. |
| 405 | Unauthorized plugin | The token does not allow this plugin. |
| 450 | Transport specific | The transport refused it (for example HTTP with a method it does not take). |
| 452 | Missing request | A request with no request member where one is needed. |
| 453 | Unknown request | The janus value is not known on this path (on the base path the server answers 457). |
| 454 | Invalid JSON | The body does not parse; the reason carries the parser's message. |
| 455 | Invalid JSON object | Parsed, but not an object. |
| 456 | Missing mandatory element | A required member is missing, for example transaction or plugin. |
| 457 | Invalid request path | The request is not valid at this path. |
| 458 | Session not found | The session id is unknown or was destroyed. |
| 459 | Handle not found | The handle id is unknown in this session. |
| 460 | Plugin not found | attach named a plugin that is not loaded. |
| 461 | Plugin attach | The plugin refused the attach. |
| 462 | Plugin message | The plugin could not take the message. |
| 463 | Plugin detach | The plugin failed to detach. |
| 464 | JSEP unknown type | jsep.type is not offer, answer and so on. |
| 465 | JSEP invalid SDP | The SDP does not parse or is missing mandatory lines. |
| 466 | Trickle invalid stream | The candidate names a stream or m-line that does not exist. |
| 467 | Invalid element type | A member has the wrong JSON type. |
| 468 | Session conflict | A session with this id exists. |
| 469 | Unexpected answer | An answer arrived without an offer pending. |
| 470 | Token not found | Admin token request names an unknown token. |
| 471 | WebRTC state | The request does not fit the PeerConnection's state. |
| 472 | Not accepting sessions | create while the server is draining (accept_new_sessions set to false). |
| 490 | Unknown / unsupported | Anything else. In this port also: an Admin request the build does not support, such as query_transport. |
Plugin errors are not Janus errors
A plugin reports its own errors inside a normal success or event: plugindata.data.error_code and plugindata.data.error. Each plugin has its own error codes, listed on the plugin pages. A client has to check both levels.
json
{
"janus": "success",
"plugindata": {
"plugin": "janus.plugin.videoroom",
"data": { "videoroom": "event", "error_code": 429, "error": "Missing mandatory element (room)" }
}
}That reply is a real one from the binary (see the last exchange of the walkthrough).