# Error codes and troubleshooting

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

See the following tables for common error codes, descriptions, and troubleshooting suggestions.

## Handle Session error events

Handle session error events for the best user experience and to prevent edge cases.

```javascript
session.on("session_error", (payload) => {
    const { code } = payload;
    console.log("error code", code);
});
```

## Start, join session failed errors

If you fail to start or join a session, try starting or joining it again.

| Error code | Error message                                                                                                                                                                                                                                                                                                                          | Exception              | Suggested action                                                                                                                        |
| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| `1001`     | `1` The website link is invalid.`2` Free trial account has no available credits.                                                                                                                                                                                                                                                       | `SESSION_START_FAILED` | The session failed to start due to a connection error, network error, or invalid Cobrowse site URL. Restart the session.                |
| `1011`     | `1` Session join failed due to an internal error.`2` SDK version is invalid.`3` Session does not exist or has ended.`4` The website link is invalid.`5` Failed to make a connection after multiple attempts.`6` Failed to reconnect after failover with multiple attempts.`7` Request to the server timed out after multiple attempts. | `SESSION_JOIN_FAILED`  | The session failed to join due to connection error or because the session has already ended. If the session is still active, rejoin it. |
| `1016`     | `1` Network request to backend failed after multiple attempts. `2` Network request to backend timed out.                                                                                                                                                                                                                               | `NETWORK_ERROR`        | The session failed to start or join session due to a network error. Try again.                                                          |

## Session limit errors

Starting or joining a session can fail due to session limit errors. See [Join flow limitations](/docs/cobrowse-sdk/support/#join-flow-limitations) for details.

-   If the number of customers or agents exceeds the allowed limit, the SDK returns `SESSION_CUSTOMER_COUNT_LIMIT` or `SESSION_AGENT_COUNT_LIMIT`.
-   If the same user repeatedly attempts to join, the SDK returns `SESSION_DUPLICATE_USER`.
-   In multiple browser tabs, only one active session is allowed. Additional attempts result in `SESSION_CONNECTING_IN_PROGRESS` or `SESSION_COUNT_LIMIT`.

| Error code | Error message                                                                       | Exception                        | Suggested action                                                                                                                 |
| ---------- | ----------------------------------------------------------------------------------- | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `1002`     | `1` A connection is already in progress.`2` A transfer session is still recovering. | `SESSION_CONNECTING_IN_PROGRESS` | A session connection is already in progress. This may be a duplicate call. Cancel the ongoing attempt or ignore the new request. |
| `1003`     | Session does not exist or has ended.                                                | `SESSION_NOT_FOUND`              | Session does not exist or has ended.                                                                                             |
| `1004`     | A session is already active.                                                        | `SESSION_COUNT_LIMIT`            | A session is already in progress on this device. End the ongoing session or ignore the new call.                                 |
| `1012`     | Maximum number of customers in a session reached.                                   | `SESSION_CUSTOMER_COUNT_LIMIT`   | Only one customer can join a session. Remove the existing customer before retrying.                                              |
| `1013`     | Maximum number of agents in a session reached.                                      | `SESSION_AGENT_COUNT_LIMIT`      | Up to five agents can join a session. Remove an agent before retrying.                                                           |
| `1015`     | The agent is already in the session.                                                | `SESSION_DUPLICATE_USER`         | The same user ID already exists in the session. Verify that the `userId` in the token is unique.                                 |
| `1017`     | Operation failed, the session is being canceled.                                    | `SESSION_CANCELING_IN_PROGRESS`  | A session is currently being canceled. Retry after the cancelation completes.                                                    |

## Handle PIN code errors

In BYOP mode, you must provide a custom PIN code in the correct format when you create a session. We recommend that you generate random PIN codes and validate that the PIN is not empty before making the call. See [Bring Your Own PIN (BYOP)](/docs/cobrowse-sdk/features/#bring-your-own-pin-byop) for details.

-   If the PIN code is already in use, the SDK returns `SESSION_START_PIN_CONFLICT`.
-   If the PIN code is empty, the SDK returns `SESSION_START_PIN_REQUIRED`.
-   If you join a session using a non-existent PIN code, ithe SDK returns `SESSION_START_PIN_REQUIRED`.
-   If you use an invalid PIN code, the SDK returns `SESSION_PIN_INVALID_FORMAT`.

| Error code | Error message                                                                    | Exception                    | Suggested action                                                                                                                                                                           |
| ---------- | -------------------------------------------------------------------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `1006`     | PIN code is not found.                                                           | `SESSION_JOIN_PIN_NOT_FOUND` | The PIN code does not exist. Check the value and try again.                                                                                                                                |
| `1008`     | `1` PIN code exceeds the maximum length`2` PIN code contains invalid characters. | `SESSION_PIN_INVALID_FORMAT` | The PIN code format is invalid. PIN codes may contain letters and numbers (case-insensitive, converted to uppercase) and must be no more than 10 characters. Check the code and try again. |
| `1009`     | PIN code is required.                                                            | `SESSION_START_PIN_REQUIRED` | In BYOP mode, you must provide a PIN code when creating a session.                                                                                                                         |
| `1010`     | PIN code has already been used.                                                  | `SESSION_START_PIN_CONFLICT` | The PIN code is currently in use. Create the session with a different PIN code.                                                                                                            |

## Other exceptions

| Error code | Error message                                                                                                                                  | Exception       | Suggested action                                                                                            |
| ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | --------------- | ----------------------------------------------------------------------------------------------------------- |
| `2001`     | `1` JWT token is invalid.`2` JWT token has no permissions.`3` JWT token has expired.`4` JWT token access error.`5` Internal token error.       | `TOKEN_INVALID` | The token is invalid or expired. Verify the token's permissions, signature, and expiry.                     |
| `9999`     | `1` Service error occurred.`2` API request rate limit, try again later.`3` Session error occurred.`4` Session error occurred, try again later. | `UNDEFINED`     | This error is caused by a Zoom service issue. Retry later, and if the issue persists, contact Zoom Support. |
