Skip to content

Subscription limit exceeded on EventSub websocket reconnect #351

Description

@Galawer

If subscribed to more than 5 events that have an associated cost, for example stream.online, resubscribing after reconnecting causes the max_total_cost of 10 to be exceeded and the resubscription to fail.

2025-09-03 02:15:57 [twitchAPI.eventsub.websocket] [DEBUG] websocket is closing
2025-09-03 02:15:57 [twitchAPI.eventsub.websocket] [DEBUG] reconnecting using wss://eventsub.wss.twitch.tv/ws...
2025-09-03 02:15:58 [twitchAPI.eventsub.websocket] [DEBUG] new session id: ************************************
2025-09-03 02:15:58 [twitchAPI.eventsub.websocket] [DEBUG] resubscribe to all active subscriptions of this websocket...
2025-09-03 02:15:58 [twitchAPI.eventsub.websocket] [DEBUG] subscribe to stream.online version 1 with condition {'broadcaster_user_id': '*********'}
2025-09-03 02:15:59 [twitchAPI.eventsub.websocket] [DEBUG] subscription for stream.online version 1 with condition {'broadcaster_user_id': '*********'} has id ********-****-****-****-************
2025-09-03 02:15:59 [twitchAPI.eventsub.websocket] [DEBUG] subscribe to stream.online version 1 with condition {'broadcaster_user_id': '*********'}
2025-09-03 02:16:00 [twitchAPI.eventsub.websocket] [DEBUG] subscription for stream.online version 1 with condition {'broadcaster_user_id': '*********'} has id ********-****-****-****-************
2025-09-03 02:16:00 [twitchAPI.eventsub.websocket] [DEBUG] subscribe to stream.online version 1 with condition {'broadcaster_user_id': '*********'}
2025-09-03 02:16:01 [twitchAPI.eventsub.websocket] [ERROR] exception while resubscribing
Traceback (most recent call last):
  File "/home/pi/scripts/python/twitch-eventsub-python/venv/lib/python3.11/site-packages/twitchAPI/eventsub/websocket.py", line 404, in _resubscribe
    await self._subscribe(**sub)
  File "/home/pi/scripts/python/twitch-eventsub-python/venv/lib/python3.11/site-packages/twitchAPI/eventsub/websocket.py", line 241, in _subscribe
    raise EventSubSubscriptionError(result.get('message'))
twitchAPI.type.EventSubSubscriptionError: websocket transport subscriptions total cost exceeded

If subscribed to 10 such events, resubscribing will fail on the first one and cause the websocket to close due to error 4003.

2025-09-01 04:10:49 [twitchAPI.eventsub.websocket] [DEBUG] websocket is closing
2025-09-01 04:10:49 [twitchAPI.eventsub.websocket] [DEBUG] reconnecting using wss://eventsub.wss.twitch.tv/ws...
2025-09-01 04:10:50 [twitchAPI.eventsub.websocket] [DEBUG] new session id: ************************************
2025-09-01 04:10:50 [twitchAPI.eventsub.websocket] [DEBUG] resubscribe to all active subscriptions of this websocket...
2025-09-01 04:10:50 [twitchAPI.eventsub.websocket] [DEBUG] subscribe to stream.online version 1 with condition {'broadcaster_user_id': '*********'}
2025-09-01 04:10:52 [twitchAPI.eventsub.websocket] [ERROR] exception while resubscribing
Traceback (most recent call last):
  File "/home/pi/scripts/python/twitch-eventsub-python/venv/lib/python3.11/site-packages/twitchAPI/eventsub/websocket.py", line 396, in _resubscribe
    await self._subscribe(**sub)
  File "/home/pi/scripts/python/twitch-eventsub-python/venv/lib/python3.11/site-packages/twitchAPI/eventsub/websocket.py", line 236, in _subscribe
    raise EventSubSubscriptionError(result.get('message'))
twitchAPI.type.EventSubSubscriptionError: websocket transport subscriptions total cost exceeded
2025-09-01 04:11:00 [twitchAPI.eventsub.websocket] [INFO] Websocket closing: 4003 - Connection unused, you have to create a subscription within 10 seconds
2025-09-01 04:11:20 [twitchAPI.eventsub.websocket] [WARNING] keepalive missed, connection lost. reconnecting...
2025-09-01 04:11:20 [twitchAPI.eventsub.websocket] [DEBUG] reconnecting using wss://eventsub.wss.twitch.tv/ws...
2025-09-01 04:11:20 [twitchAPI.eventsub.websocket] [DEBUG] new session id: ************************************
2025-09-01 04:11:20 [twitchAPI.eventsub.websocket] [DEBUG] resubscribe to all active subscriptions of this websocket...
2025-09-01 04:11:20 [twitchAPI.eventsub.websocket] [DEBUG] subscribe to stream.online version 1 with condition {'broadcaster_user_id': '*********'}
2025-09-01 04:11:21 [twitchAPI.eventsub.websocket] [ERROR] exception while resubscribing
Traceback (most recent call last):
  File "/home/pi/scripts/python/twitch-eventsub-python/venv/lib/python3.11/site-packages/twitchAPI/eventsub/websocket.py", line 396, in _resubscribe
    await self._subscribe(**sub)
  File "/home/pi/scripts/python/twitch-eventsub-python/venv/lib/python3.11/site-packages/twitchAPI/eventsub/websocket.py", line 236, in _subscribe
    raise EventSubSubscriptionError(result.get('message'))
twitchAPI.type.EventSubSubscriptionError: websocket transport subscriptions total cost exceeded
2025-09-01 04:11:30 [twitchAPI.eventsub.websocket] [INFO] Websocket closing: 4003 - Connection unused, you have to create a subscription within 10 seconds
2025-09-01 04:11:50 [twitchAPI.eventsub.websocket] [WARNING] keepalive missed, connection lost. reconnecting...
2025-09-01 04:11:50 [twitchAPI.eventsub.websocket] [DEBUG] reconnecting using wss://eventsub.wss.twitch.tv/ws...
2025-09-01 04:11:50 [twitchAPI.eventsub.websocket] [DEBUG] new session id: ************************************
2025-09-01 04:11:50 [twitchAPI.eventsub.websocket] [DEBUG] resubscribe to all active subscriptions of this websocket...
2025-09-01 04:11:50 [twitchAPI.eventsub.websocket] [DEBUG] subscribe to stream.online version 1 with condition {'broadcaster_user_id': '*********'}
2025-09-01 04:11:51 [twitchAPI.eventsub.websocket] [DEBUG] subscription for stream.online version 1 with condition {'broadcaster_user_id': '*********'} has id ********-****-****-****-************

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions