#2545·LangBot

[Bug]: Windows 环境下 Box Runtime 启动失败及插件安装超时问题

Author: MujinsuCreated Sep 15, 2026Updated Sep 15, 2026
Labelsbug?

运行环境

langbot-v4.10.11-all、Windows 10.0.20348.4405、Python311

部署版本

社区版

异常情况

1. Box Runtime 启动失败,沙箱功能不可用

启动日志中反复出现 OSError: [WinError 6] 句柄无效 和 AttributeError: '_ProactorReadPipeTransport' object has no attribute '_empty_waiter',导致 Box Runtime 无法通过 Stdio 连接。最终提示:

LangBot Box backend unavailable: no supported sandbox backend (Docker, nsjail, E2B) is ready
Native sandbox tools (exec/read/write/edit/glob/grep) are NOT available

所有依赖沙箱的代码执行、文件操作、Skill 激活等功能均被禁用。

2. 插件安装超时,依赖准备失败

在 WebUI 插件市场安装插件时,依赖安装阶段超时:

Plugin dependency preparation failed for installation ...: Plugin dependency installation timed out
Action apply_plugin_installation call timed out

随后插件运行时连接断开:

Connection closed by local runtime
Plugin runtime is not connected

即使插件运行时曾短暂连接成功(Connected to instance-scoped plugin runtime),安装过程仍无法完成。

关键日志摘录

Box Runtime 错误

[09-15 22:31:23.608] base_events.py (1771) - [ERROR] : Exception in callback _ProactorReadPipeTransport._loop_reading()
...
OSError: [WinError 6] 句柄无效。
...
AttributeError: '_ProactorReadPipeTransport' object has no attribute '_empty_waiter'
[09-15 22:31:23.816] service.py (194) - [WARNING] : LangBot Box runtime unavailable, sandbox features disabled: box runtime connection failed: Connection closed

插件安装超时

[09-15 22:27:48.382] mgr.py (1017) - [ERROR] : Plugin dependency preparation failed for installation db473931-a080-4c6e-9d0e-a7fb707cf99a: Plugin dependency installation timed out
[09-15 22:29:14.462] pipelinemgr.py (462) - [ERROR] : Error processing query 11 stage=unknown : Action apply_plugin_installation call timed out

插件运行时断开

[09-15 22:34:47.556] pipelinemgr.py (462) - [ERROR] : Error processing query 0 stage=unknown : Connection closed by local runtime
[09-15 22:34:47.650] pipelinemgr.py (462) - [ERROR] : Error processing query 1 stage=unknown : Plugin runtime is not connected

可能的原因

  1. Windows asyncio 兼容性问题 Windows 默认的 ProactorEventLoop 对 Stdio 管道支持不完善,导致 connect_write_pipe 失败(WinError 6)。而 SelectorEventLoop 又不支持子进程,两者难以兼顾。
  2. 插件依赖安装超时 依赖安装过程可能因管道阻塞或网络问题超时。
  3. 插件运行时连接不稳定 在依赖安装失败后,运行时连接断开,重连机制未能及时恢复。(该问题在其他issues中也被提及)

附加信息

完整日志文件已附上:

LangBot instance id: instance_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
LangBot edition: community

[09-15 22:31:00.054] mgr.py (366) - [INFO] : Initialized local storage backend.
[09-15 22:31:00.056] mgr.py (159) - [INFO] : Initializing database type: sqlite...
...
[09-15 22:31:19.535] modelmgr.py (333) - [INFO] : Loading models from db...
[09-15 22:31:22.313] connector.py (239) - [INFO] : Use stdio to connect to box runtime
[09-15 22:31:23.608] nsjail_backend.py (95) - [INFO] : nsjail binary not found in PATH
[09-15 22:31:23.608] runtime.py (1717) - [ERROR] : LangBot Box backend "local" probed but not available (box.backend=local)
[09-15 22:31:23.608] runtime.py (1722) - [WARNING] : LangBot Box backend unavailable: no supported sandbox backend (Docker, nsjail, E2B) is ready; the unsafe host backend is available only through explicit box.backend=host configuration
[09-15 22:31:23.608] server.py (1257) - [INFO] : Box server listening on 0.0.0.0:5410
[09-15 22:31:23.608] base_events.py (1771) - [ERROR] : Exception in callback _ProactorReadPipeTransport._loop_reading()
handle: <Handle _ProactorReadPipeTransport._loop_reading()>
Traceback (most recent call last):
  File "C:\Users\\\xxxxx\AppData\Local\Programs\Python\Python311\Lib\asyncio\proactor_events.py", line 305, in _loop_reading
    self._read_fut = self._loop._proactor.recv_into(self._sock, self._data)
  File "C:\Users\\\xxxxx\AppData\Local\Programs\Python\Python311\Lib\asyncio\windows_events.py", line 482, in recv_into
    self._register_with_iocp(conn)
  File "C:\Users\\\xxxxx\AppData\Local\Programs\Python\Python311\Lib\asyncio\windows_events.py", line 752, in _register_with_iocp
    _overlapped.CreateIoCompletionPort(obj.fileno(), self._iocp, 0, 0)
OSError: [WinError 6] 句柄无效。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  ...
  File "C:\Users\\\xxxxx\AppData\Local\Programs\Python\Python311\Lib\asyncio\proactor_events.py", line 135, in _force_close
    if self._empty_waiter is not None and not self._empty_waiter.done():
AttributeError: '_ProactorReadPipeTransport' object has no attribute '_empty_waiter'

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  ...
  File "C:\Users\\\xxxxx\Desktop\Bot\Langbot\langbot-v4.10.11-all\.venv\Lib\site-packages\langbot_plugin\box\server.py", line 1283, in _run_server
    await ctrl.run(new_connection_callback)
  File "C:\Users\\\xxxxx\Desktop\Bot\Langbot\langbot-v4.10.11-all\.venv\Lib\site-packages\langbot_plugin\runtime\io\controllers\stdio\server.py", line 32, in run
    stdin_reader, stdout_writer = await connect_stdin_stdout()
  File "C:\Users\\\xxxxx\Desktop\Bot\Langbot\langbot-v4.10.11-all\.venv\Lib\site-packages\langbot_plugin\runtime\io\controllers\stdio\server.py", line 22, in connect_stdin_stdout
    w_transport, _ = await loop.connect_write_pipe(lambda: dummy, sys.stdout)
  File "C:\Users\\\xxxxx\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 1605, in connect_write_pipe
    transport = self._make_write_pipe_transport(pipe, protocol, waiter)
  File "C:\Users\\\xxxxx\AppData\Local\Programs\Python\Python311\Lib\asyncio\proactor_events.py", line 681, in _make_write_pipe_transport
    return _ProactorWritePipeTransport(self,
  File "C:\Users\\\xxxxx\AppData\Local\Programs\Python\Python311\Lib\asyncio\proactor_events.py", line 440, in __init__
    self._read_fut = self._loop._proactor.recv(self._sock, 16)
  File "C:\Users\\\xxxxx\AppData\Local\Programs\Python\Python311\Lib\asyncio\windows_events.py", line 459, in recv
    self._register_with_iocp(conn)
  File "C:\Users\\\xxxxx\AppData\Local\Programs\Python\Python311\Lib\asyncio\windows_events.py", line 752, in _register_with_iocp
    _overlapped.CreateIoCompletionPort(obj.fileno(), self._iocp, 0, 0)
OSError: [WinError 6] 句柄无效。

[09-15 22:31:23.816] service.py (194) - [WARNING] : LangBot Box runtime unavailable, sandbox features disabled: box runtime connection failed: Connection closed
[09-15 22:31:23.832] native.py (222) - [WARNING] : Native sandbox tools (exec/read/write/edit/glob/grep) are NOT available. No sandbox backend (Docker/nsjail/E2B) is ready. Trusted local development may explicitly select box.backend=host. The LLM will not have access to code execution or file operation tools.
[09-15 22:31:23.832] skill_authoring.py (43) - [INFO] : Skill tools (activate/register_skill) are NOT available. No sandbox backend (Docker/nsjail/E2B) is ready.

...
[09-15 22:31:47.517] connector.py (968) - [INFO] : (windows) use cmd to launch plugin runtime and communicate via ws
[2026-09-15 22:31:47 +0800] [6004] [INFO] Running on http://0.0.0.0:2280 (CTRL + C to quit)
[2026-09-15 22:31:47 +0800] [6004] [INFO] Running on http://0.0.0.0:5300 (CTRL + C to quit)
[09-15 22:31:49.231] server.py (109) - [INFO] : WebSocket server started on 0.0.0.0:5400
[09-15 22:31:49.232] server.py (109) - [INFO] : WebSocket server started on 0.0.0.0:5401
[09-15 22:31:49.551] server.py (117) - [INFO] : New connection from ('127.0.0.1', 53377)
[09-15 22:31:49.553] app.py (176) - [INFO] : Got control connection.
[09-15 22:31:49.561] control.py (636) - [INFO] : Runtime cloud_service_url set by LangBot: https://space.langbot.app
[09-15 22:31:49.562] app.py (208) - [INFO] : Ensuring all installed plugins dependencies are installed...
[09-15 22:31:49.562] connector.py (922) - [INFO] : Pushed marketplace URL to plugin runtime: https://space.langbot.app

...
[2026-09-15 22:32:41 +0800] [6004] [INFO] 127.0.0.1:53462 POST /api/v1/plugins/install/marketplace 1.1 200 44 48961
[2026-09-15 22:32:42 +0800] [6004] [INFO] 127.0.0.1:53466 GET /api/v1/system/tasks/12 1.1 200 579 21383
...(大量重复的 GET /api/v1/system/tasks/12 轮询日志省略)...
[09-15 22:34:47.556] pipelinemgr.py (462) - [ERROR] : Error processing query 0 stage=unknown : Connection closed by local runtime
[09-15 22:34:47.644] pipelinemgr.py (463) - [ERROR] : Traceback:
Traceback (most recent call last):
  File "C:\Users\\\xxxxx\Desktop\Bot\Langbot\langbot-v4.10.11-all\src\langbot\pkg\pipeline\pipelinemgr.py", line 418, in process_query
    event_ctx = await self.ap.plugin_connector.emit_event(event_obj, bound_plugins)
  ...
  File "C:\Users\\\xxxxx\Desktop\Bot\Langbot\langbot-v4.10.11-all\.venv\Lib\site-packages\langbot_plugin\runtime\io\handler.py", line 543, in call_action
    response = await asyncio.wait_for(future, timeout)
  ...
langbot_plugin.entities.io.errors.ConnectionClosedError: Connection closed by local runtime

[09-15 22:34:47.650] pipelinemgr.py (462) - [ERROR] : Error processing query 1 stage=unknown : Plugin runtime is not connected
[09-15 22:34:47.653] pipelinemgr.py (463) - [ERROR] : Traceback:
...
langbot.pkg.plugin.connector.PluginRuntimeNotConnectedError: Plugin runtime is not connected

[09-15 22:34:47.675] app.py (310) - [WARNING] : Plugin runtime unavailable during startup; reconnecting in background: Plugin runtime did not become ready within 180 seconds
[09-15 22:34:47.699] connector.py (968) - [INFO] : (windows) use cmd to launch plugin runtime and communicate via ws
[09-15 22:34:49.737] server.py (117) - [INFO] : New connection from ('127.0.0.1', 53590)
[09-15 22:34:49.737] app.py (176) - [INFO] : Got control connection.
[09-15 22:34:49.769] control.py (636) - [INFO] : Runtime cloud_service_url set by LangBot: https://space.langbot.app
[09-15 22:34:49.769] connector.py (922) - [INFO] : Pushed marketplace URL to plugin runtime: https://space.langbot.app

已尝试手动启动插件运行时(uv run --no-sync lbp rt),但端口 5400 被主程序自动启动的实例占用,说明主程序已尝试管理运行时,但安装流程仍失败。

复现步骤

  1. 在 Windows 10 上下载 LangBot v4.10.11-all 版本。
  2. 使用 uv run main.py 启动 LangBot。
  3. 访问 WebUI(http://127.0.0.1:5300)。
  4. 在插件市场选择任意插件进行安装。
  5. 观察控制台日志,出现上述错误。

启用的插件