# Join meeting error after host ends the session

**URL:** <https://devforum.zoom.us/t/join-meeting-error-after-host-ends-the-session/122226>\
**Category:** Web\
**Created:** [December 10, 2024, 3:03pm UTC](https://devforum.zoom.us/t/join-meeting-error-after-host-ends-the-session/122226 "2024-12-10T15:03:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lmtruong1512](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/lmtruong1512/32/59233_2.png) [@lmtruong1512](https://devforum.zoom.us/u/lmtruong1512)\
**Post date:** [December 10, 2024, 3:03pm UTC](https://devforum.zoom.us/t/join-meeting-error-after-host-ends-the-session/122226/1 "2024-12-10T15:03:38Z")

</div>

**Description**

When the host ends the meeting (client.leave(true)), and the guest attempts to join the room simultaneously, calling `client.join(meetingId, token, userName, passcode)` from ZoomSDK returns an error: Error: {“type”: “JOIN\_MEETING\_FAILED”, “reason”: “meeting ended”, “errorCode”: 4004}.

if guest init too long after host ended the meeting. When call client.join(meetingId, token, userName, passcode) will create new meeting session instead.

I want to know exactly when each scenario occurs. Example:

- \< 500ms after the host ends the Zoom meeting\*\*: Calling `client.join(meetingId, token, userName, passcode)` will throw error `4004`.
- After 500ms: Calling `client.join(meetingId, token, userName, passcode)` will succeed and start a new meeting session.?

Thank you very much for your help!

**Which Web Video SDK version?**  
1.12.10

**Device (please complete the following information):**

- Device: MacMini
- OS: 15.1
- Browser: Chrome
- Browser Version : 131.0.6778.109

---

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [December 12, 2024, 6:07am UTC](https://devforum.zoom.us/t/join-meeting-error-after-host-ends-the-session/122226/2 "2024-12-12T06:07:19Z")

</div>

Hey @lmtruong1512

Thanks for your feedback.

There is indeed a scenario where the meeting is ended, which is unrelated to the `client.init` method but rather to the `client.join` method. However, I can’t give you a specific time threshold. The issue usually occurs during the process of a user joining a session when the host ends the session.

The process of joining a session involves two steps:

1. **Retrieve the session ID using the topic** : If there is an in-progress session under the same topic, the existing session is returned; otherwise, a new session is created.
2. **Connect to the media server using the session ID**.

This creates some edge cases. If step 1 is completed but step 2 has not yet finished connecting to the media server, and the host ends the session during this time, it results in a `JOIN_MEETING_FAILED` error.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [January 11, 2025, 4:07pm UTC](https://devforum.zoom.us/t/join-meeting-error-after-host-ends-the-session/122226/3 "2025-01-11T16:07:24Z")

</div>

Closed on January 11, 2025, 4:07pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
