HKUDS/DeepTutor · error · RuntimeError
WeChat session paused
Error message
WeChat session paused, {remaining_min} min remaining (errcode {ERRCODE_SESSION_EXPIRED}) What it means
WeChat channel self-protection: after repeated ERR_SESSION_EXPIRED responses the channel entered a pause window, and _assert_session_active detected remaining pause time. Messages are not processed until the pause (SESSION_PAUSE_DURATION_S) elapses; the message includes minutes remaining and the errcode.
Solutions
- Wait for the pause window to expire; polling resumes automatically
- Address the underlying WeChat session expiry (re-auth credentials / access token refresh) to avoid re-triggering pauses
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at deeptutor/partners/channels/weixin.py:535 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27).
Data as JSON: /api/errors/5cd3cabd3d6aa1a5.
Report an issue: GitHub.
Appendix: source
Thrown at deeptutor/partners/channels/weixin.py:535
# ------------------------------------------------------------------
def _pause_session(self, duration_s: int = SESSION_PAUSE_DURATION_S) -> None:
self._session_pause_until = time.time() + duration_s
def _session_pause_remaining_s(self) -> int:
remaining = int(self._session_pause_until - time.time())
if remaining <= 0:
self._session_pause_until = 0.0
return 0
return remaining
def _assert_session_active(self) -> None:
remaining = self._session_pause_remaining_s()
if remaining > 0:
remaining_min = max((remaining + 59) // 60, 1)
raise RuntimeError(
f"WeChat session paused, {remaining_min} min remaining (errcode {ERRCODE_SESSION_EXPIRED})"
)
async def _poll_once(self) -> None:
remaining = self._session_pause_remaining_s()
if remaining > 0:
await asyncio.sleep(remaining)
return
body: dict[str, Any] = {
"get_updates_buf": self._get_updates_buf,
"base_info": BASE_INFO,
}
# Adjust httpx timeout to match the current poll timeout
assert self._client is not None
self._client.timeout = httpx.Timeout(self._next_poll_timeout_s + 10, connect=30)
data = await self._api_post("ilink/bot/getupdates", body)
View on GitHub (pinned to 3e82f13042)