What happened / 发生了什么
在更新到最新版本4.23.1的 AstrBot 后,控制台不断报出 解析版本信息时发生异常: Server disconnected 的错误,导致无法正常获取项目更新。
经过排查发现,原因可能在于新版本的更新检查模块使用了 aiohttp,而 aiohttp 原生不支持读取系统环境变量中的 socks5:// 代理协议(需要额外配置 aiohttp-socks)。当它读取到系统的 socks5 代理配置时,会导致连接瞬间被代理服务器掐断。
由于 AstrBot 的 Telegram 适配器目前没有独立的代理配置项,为了维持 Telegram bot 的长连接稳定(长轮询),宿主机/容器必须配置全局的 socks5 代理(走 HTTP 代理会导致 TG 频繁断连)。这就导致了 Telegram 的网络需求与 aiohttp 的代理兼容性产生了不可调和的冲突。
顺带一提,在上一个版本的 AstrBot 中配置同样的 socks5 环境变量,并没有出现无法检测更新的报错,猜测是底层网络请求库发生了变更。
Reproduce / 如何复现?
- 配置socks5系统代理
- 重启AstrBot
- 点击WebUI右上角的“更新AstrBot”
- 观察AstrBot控制台输出
AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器
4.23.1,Docker Compose,此bug与提供商无关,Telegram
OS
Linux
Logs / 报错日志
[2026-04-15 22:18:24.103] [Core] [ERRO] [v4.23.1] [core.zip_updator:84]: 解析版本信息时发生异常: Server disconnected
[2026-04-15 22:18:24.103] [Core] [WARN] [v4.23.1] [routes.update:77]: 检查更新失败: 解析版本信息失败 (不影响除项目更新外的正常使用)
[2026-04-15 22:18:24.119] [Core] [ERRO] [v4.23.1] [core.zip_updator:84]: 解析版本信息时发生异常: Server disconnected
[2026-04-15 22:18:24.132] [Core] [ERRO] [v4.23.1] [routes.update:85]: /api/update/releases: Traceback (most recent call last):
File "/AstrBot/astrbot/core/zip_updator.py", line 56, in fetch_release_info
session.get(url) as response,
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1521, in aenter
self._resp: _RetType = await self._coro
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 788, in _request
resp = await handler(req)
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 742, in _connect_and_send_request
conn = await self._connector.connect(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 672, in connect
proto = await self._create_connection(req, traces, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1249, in _create_connection
_, proto = await self._create_proxy_connection(req, traces, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1668, in _create_proxy_connection
resp = await proxy_resp.start(conn)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 539, in start
message, payload = await protocol.read() # type: ignore[union-attr]
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/streams.py", line 707, in read
await self._waiter
aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/AstrBot/astrbot/dashboard/routes/update.py", line 82, in get_releases
ret = await self.astrbot_updator.get_releases()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/AstrBot/astrbot/core/updator.py", line 145, in get_releases
return await self.fetch_release_info(self.ASTRBOT_RELEASE_API)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/AstrBot/astrbot/core/zip_updator.py", line 85, in fetch_release_info
raise Exception("解析版本信息失败")
Exception: 解析版本信息失败
Are you willing to submit a PR? / 你愿意提交 PR 吗?
Code of Conduct
What happened / 发生了什么
在更新到最新版本4.23.1的 AstrBot 后,控制台不断报出 解析版本信息时发生异常: Server disconnected 的错误,导致无法正常获取项目更新。
经过排查发现,原因可能在于新版本的更新检查模块使用了 aiohttp,而 aiohttp 原生不支持读取系统环境变量中的 socks5:// 代理协议(需要额外配置 aiohttp-socks)。当它读取到系统的 socks5 代理配置时,会导致连接瞬间被代理服务器掐断。
由于 AstrBot 的 Telegram 适配器目前没有独立的代理配置项,为了维持 Telegram bot 的长连接稳定(长轮询),宿主机/容器必须配置全局的 socks5 代理(走 HTTP 代理会导致 TG 频繁断连)。这就导致了 Telegram 的网络需求与 aiohttp 的代理兼容性产生了不可调和的冲突。
顺带一提,在上一个版本的 AstrBot 中配置同样的 socks5 环境变量,并没有出现无法检测更新的报错,猜测是底层网络请求库发生了变更。
Reproduce / 如何复现?
AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器
4.23.1,Docker Compose,此bug与提供商无关,Telegram
OS
Linux
Logs / 报错日志
[2026-04-15 22:18:24.103] [Core] [ERRO] [v4.23.1] [core.zip_updator:84]: 解析版本信息时发生异常: Server disconnected
[2026-04-15 22:18:24.103] [Core] [WARN] [v4.23.1] [routes.update:77]: 检查更新失败: 解析版本信息失败 (不影响除项目更新外的正常使用)
[2026-04-15 22:18:24.119] [Core] [ERRO] [v4.23.1] [core.zip_updator:84]: 解析版本信息时发生异常: Server disconnected
[2026-04-15 22:18:24.132] [Core] [ERRO] [v4.23.1] [routes.update:85]: /api/update/releases: Traceback (most recent call last):
File "/AstrBot/astrbot/core/zip_updator.py", line 56, in fetch_release_info
session.get(url) as response,
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1521, in aenter
self._resp: _RetType = await self._coro
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 788, in _request
resp = await handler(req)
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 742, in _connect_and_send_request
conn = await self._connector.connect(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 672, in connect
proto = await self._create_connection(req, traces, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1249, in _create_connection
_, proto = await self._create_proxy_connection(req, traces, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1668, in _create_proxy_connection
resp = await proxy_resp.start(conn)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 539, in start
message, payload = await protocol.read() # type: ignore[union-attr]
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/streams.py", line 707, in read
await self._waiter
aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/AstrBot/astrbot/dashboard/routes/update.py", line 82, in get_releases
ret = await self.astrbot_updator.get_releases()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/AstrBot/astrbot/core/updator.py", line 145, in get_releases
return await self.fetch_release_info(self.ASTRBOT_RELEASE_API)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/AstrBot/astrbot/core/zip_updator.py", line 85, in fetch_release_info
raise Exception("解析版本信息失败")
Exception: 解析版本信息失败
Are you willing to submit a PR? / 你愿意提交 PR 吗?
Code of Conduct