[Bug]: 微信公众号适配器处理回调请求时返回 500 错误
Runtime environment
LangBot 版本:手动部署,最新版 操作系统:Ubuntu 24.04 Python 版本:3.x 部署方式:manual 反向代理:Caddy
Deployment version
Community Edition
Exception
root@iZ2zehn6xwzfca9hv06dqzZ:# cat /home/admin/langbot/langbot.log | tail -100
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/admin/langbot/.venv/lib/python3.12/site-packages/quart/app.py", line 1503, in full_dispatch_request
return await self.finalize_request(result, request_context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/admin/langbot/.venv/lib/python3.12/site-packages/quart/app.py", line 1628, in finalize_request
response = await self.make_response(result)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/admin/langbot/.venv/lib/python3.12/site-packages/quart/app.py", line 1430, in make_response
raise TypeError(
TypeError: The response value returned by the view function cannot be None
[2026-09-26 10:14:26 +0800] [63215] [INFO] 127.0.0.1:46014 POST /bots/54988f70-6dd9-4de9-b164-3d4ab382f601 1.1 500 265 13831
Traceback (most recent call last):
File "/home/admin/langbot/src/langbot/libs/official_account_api/api.py", line 154, in _handle_callback_internal
xml_msg = xml_msg.decode('utf-8')
^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'decode'
[09-26 10:14:26.534] app.py (1145) - [ERROR] : Exception on request POST /bots/54988f70-6dd9-4de9-b164-3d4ab382f601
Traceback (most recent call last):
File "/home/admin/langbot/.venv/lib/python3.12/site-packages/quart/app.py", line 1464, in handle_request
return await self.full_dispatch_request(request_context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/admin/langbot/.venv/lib/python3.12/site-packages/quart/app.py", line 1503, in full_dispatch_request
return await self.finalize_request(result, request_context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/admin/langbot/.venv/lib/python3.12/site-packages/quart/app.py", line 1628, in finalize_request
response = await self.make_response(result)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/admin/langbot/.venv/lib/python3.12/site-packages/quart/app.py", line 1430, in make_response
raise TypeError(
TypeError: The response value returned by the view function cannot be None
[2026-09-26 10:14:26 +0800] [63215] [INFO] 127.0.0.1:46016 POST /bots/54988f70-6dd9-4de9-b164-3d4ab382f601 1.1 500 265 13806
[2026-09-26 10:14:26 +0800] [63215] [INFO] 127.0.0.1:46024 GET /api/v1/survey/pending 1.1 200 45 15718
[2026-09-26 10:15:27 +0800] [63215] [INFO] 127.0.0.1:44076 GET /api/v1/survey/pending 1.1 200 45 17992
Traceback (most recent call last):
File "/home/admin/langbot/src/langbot/libs/official_account_api/api.py", line 154, in _handle_callback_internal
xml_msg = xml_msg.decode('utf-8')
^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'decode'
[09-26 10:15:30.631] app.py (1145) - [ERROR] : Exception on request POST /bots/54988f70-6dd9-4de9-b164-3d4ab382f601
Traceback (most recent call last):
File "/home/admin/langbot/.venv/lib/python3.12/site-packages/quart/app.py", line 1464, in handle_request
return await self.full_dispatch_request(request_context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/admin/langbot/.venv/lib/python3.12/site-packages/quart/app.py", line 1503, in full_dispatch_request
return await self.finalize_request(result, request_context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/admin/langbot/.venv/lib/python3.12/site-packages/quart/app.py", line 1628, in finalize_request
response = await self.make_response(result)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/admin/langbot/.venv/lib/python3.12/site-packages/quart/app.py", line 1430, in make_response
raise TypeError(
TypeError: The response value returned by the view function cannot be None
[2026-09-26 10:15:30 +0800] [63215] [INFO] 127.0.0.1:44088 POST /bots/54988f70-6dd9-4de9-b164-3d4ab382f601 1.1 500 265 15266
Traceback (most recent call last):
File "/home/admin/langbot/src/langbot/libs/official_account_api/api.py", line 154, in _handle_callback_internal
xml_msg = xml_msg.decode('utf-8')
^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'decode'
[09-26 10:15:30.820] app.py (1145) - [ERROR] : Exception on request POST /bots/54988f70-6dd9-4de9-b164-3d4ab382f601
Traceback (most recent call last):
File "/home/admin/langbot/.venv/lib/python3.12/site-packages/quart/app.py", line 1464, in handle_request
return await self.full_dispatch_request(request_context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/admin/langbot/.venv/lib/python3.12/site-packages/quart/app.py", line 1503, in full_dispatch_request
return await self.finalize_request(result, request_context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/admin/langbot/.venv/lib/python3.12/site-packages/quart/app.py", line 1628, in finalize_request
response = await self.make_response(result)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/admin/langbot/.venv/lib/python3.12/site-packages/quart/app.py", line 1430, in make_response
raise TypeError(
TypeError: The response value returned by the view function cannot be None
[2026-09-26 10:15:30 +0800] [63215] [INFO] 127.0.0.1:44092 POST /bots/54988f70-6dd9-4de9-b164-3d4ab382f601 1.1 500 265 20533
Traceback (most recent call last):
File "/home/admin/langbot/src/langbot/libs/official_account_api/api.py", line 154, in _handle_callback_internal
xml_msg = xml_msg.decode('utf-8')
^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'decode'
[09-26 10:15:30.995] app.py (1145) - [ERROR] : Exception on request POST /bots/54988f70-6dd9-4de9-b164-3d4ab382f601
Traceback (most recent call last):
File "/home/admin/langbot/.venv/lib/python3.12/site-packages/quart/app.py", line 1464, in handle_request
return await self.full_dispatch_request(request_context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/admin/langbot/.venv/lib/python3.12/site-packages/quart/app.py", line 1503, in full_dispatch_request
return await self.finalize_request(result, request_context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/admin/langbot/.venv/lib/python3.12/site-packages/quart/app.py", line 1628, in finalize_request
response = await self.make_response(result)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/admin/langbot/.venv/lib/python3.12/site-packages/quart/app.py", line 1430, in make_response
raise TypeError(
TypeError: The response value returned by the view function cannot be None
[2026-09-26 10:15:30 +0800] [63215] [INFO] 127.0.0.1:44102 POST /bots/54988f70-6dd9-4de9-b164-3d4ab382f601 1.1 500 265 24787
[2026-09-26 10:16:02 +0800] [63215] [INFO] 127.0.0.1:34476 GET /images/images/cache.php 1.1 - - 3320
[2026-09-26 10:16:10 +0800] [63215] [INFO] 127.0.0.1:52488 GET /images/images/cache.php 1.1 - - 4215
[2026-09-26 10:16:28 +0800] [63215] [INFO] 127.0.0.1:46300 GET /api/v1/survey/pending 1.1 200 45 18537
[09-26 10:13:29.439] stdio.py (246) - [ERROR] : Error receiving message: 标准输出流已关闭。
[09-26 10:13:29.925] stdio.py (246) - [ERROR] : Error receiving message: 标准输出流已关闭。
[09-26 10:13:31.930] app.py (356) - [INFO] : Runtime application cancelled
[Signal] Program exit.
root@iZ2zehn6xwzfca9hv06dqzZ:#
Reproduction steps
- 在 LangBot 中创建微信公众号机器人,配置 AppID、AppSecret、Token、EncodingAESKey
- 在微信开发者平台配置消息推送,URL 填 https://hailaoshi.com/bots/54988f70-6dd9-4de9-b164-3d4ab382f601
- 点击保存时,微信返回错误码 200302
- 手动 curl 该回调地址,返回 500 Internal Server Error
- LangBot 日志显示 handle_callback_request 失败
Enabled plugins
No response
Source: langbot-app/LangBot