Failed to run code-interpreter example #627
Unanswered
rochiechan99-collab
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Follow the steps in examples/code-interpreter/README.md, and get an error:"httpcore.RemoteProtocolError: peer closed connection without sending complete message body (incomplete chunked read)".
2026-04-02 15:44:06,886 - opensandbox.sandbox - INFO - sandbox.py:449 - Creating sandbox with image: sandbox-registry.cn-zhangjiakou.cr.aliyuncs.com/opensandbox/code-interpreter:v1.0.2 (timeout: 600.0s)
2026-04-02 15:44:06,887 - opensandbox.adapters.sandboxes_adapter - INFO - sandboxes_adapter.py:124 - Creating sandbox with image: sandbox-registry.cn-zhangjiakou.cr.aliyuncs.com/opensandbox/code-interpreter:v1.0.2
INFO: 2026-04-02 15:44:06+0800 [386b12cd414c4cb3bc88d7c93f3fbb6f] opensandbox_server.services.docker: sandbox=efd83915-5979-4578-a621-0f39afc8dc45 | action=inspect image sandbox-registry.cn-zhangjiakou.cr.aliyuncs.com/opensandbox/code-interpreter:v1.0.2 | duration=4.63
INFO: 2026-04-02 15:44:06+0800 [386b12cd414c4cb3bc88d7c93f3fbb6f] opensandbox_server.services.docker: sandbox=efd83915-5979-4578-a621-0f39afc8dc45 | action=create sandbox container | duration=55.18
INFO: 2026-04-02 15:44:07+0800 [386b12cd414c4cb3bc88d7c93f3fbb6f] opensandbox_server.services.docker: sandbox=efd83915-5979-4578-a621-0f39afc8dc45 | action=ensure directory /opt/opensandbox | duration=121.12
INFO: 2026-04-02 15:44:07+0800 [386b12cd414c4cb3bc88d7c93f3fbb6f] opensandbox_server.services.docker: sandbox=efd83915-5979-4578-a621-0f39afc8dc45 | action=copy execd archive to sandbox | duration=176.73
INFO: 2026-04-02 15:44:07+0800 [386b12cd414c4cb3bc88d7c93f3fbb6f] opensandbox_server.services.docker: sandbox=efd83915-5979-4578-a621-0f39afc8dc45 | action=ensure directory /opt/opensandbox | duration=122.11
INFO: 2026-04-02 15:44:07+0800 [386b12cd414c4cb3bc88d7c93f3fbb6f] opensandbox_server.services.docker: sandbox=efd83915-5979-4578-a621-0f39afc8dc45 | action=install bootstrap script | duration=126.47
INFO: 2026-04-02 15:44:08+0800 [386b12cd414c4cb3bc88d7c93f3fbb6f] opensandbox_server.services.docker: sandbox=efd83915-5979-4578-a621-0f39afc8dc45 | action=start sandbox container | duration=798.26
INFO: 2026-04-02 15:44:08+0800 [-] uvicorn.access: 127.0.0.1:53888 - "POST /v1/sandboxes HTTP/1.1" 202
2026-04-02 15:44:08,317 - httpx - INFO - _client.py:1740 - HTTP Request: POST http://localhost:8080/v1/sandboxes "HTTP/1.1 202 Accepted"
2026-04-02 15:44:08,320 - opensandbox.adapters.sandboxes_adapter - INFO - sandboxes_adapter.py:152 - Successfully created sandbox: efd83915-5979-4578-a621-0f39afc8dc45
INFO: 2026-04-02 15:44:08+0800 [-] uvicorn.access: 127.0.0.1:53888 - "GET /v1/sandboxes/efd83915-5979-4578-a621-0f39afc8dc45/endpoints/44772?use_server_proxy=false HTTP/1.1" 200
2026-04-02 15:44:08,335 - httpx - INFO - _client.py:1740 - HTTP Request: GET http://localhost:8080/v1/sandboxes/efd83915-5979-4578-a621-0f39afc8dc45/endpoints/44772?use_server_proxy=false "HTTP/1.1 200 OK"
INFO: 2026-04-02 15:44:08+0800 [-] uvicorn.access: 127.0.0.1:53888 - "GET /v1/sandboxes/efd83915-5979-4578-a621-0f39afc8dc45/endpoints/18080?use_server_proxy=false HTTP/1.1" 200
2026-04-02 15:44:08,349 - httpx - INFO - _client.py:1740 - HTTP Request: GET http://localhost:8080/v1/sandboxes/efd83915-5979-4578-a621-0f39afc8dc45/endpoints/18080?use_server_proxy=false "HTTP/1.1 200 OK"
2026-04-02 15:44:08,357 - opensandbox.sandbox - INFO - sandbox.py:331 - Waiting for sandbox efd83915-5979-4578-a621-0f39afc8dc45 to pass health check (timeout: 30.0s)
2026-04-02 15:44:08,364 - httpx - INFO - _client.py:1740 - HTTP Request: GET http://127.0.0.1:53861/proxy/44772/ping "HTTP/1.1 200 OK"
2026-04-02 15:44:08,366 - opensandbox.sandbox - INFO - sandbox.py:346 - Sandbox efd83915-5979-4578-a621-0f39afc8dc45 passed health check after 1 attempts
2026-04-02 15:44:08,366 - opensandbox.sandbox - INFO - sandbox.py:494 - Sandbox efd83915-5979-4578-a621-0f39afc8dc45 is ready
2026-04-02 15:44:08,366 - code_interpreter.code_interpreter - INFO - code_interpreter.py:199 - Creating code interpreter from sandbox: efd83915-5979-4578-a621-0f39afc8dc45
INFO: 2026-04-02 15:44:08+0800 [-] uvicorn.access: 127.0.0.1:53888 - "GET /v1/sandboxes/efd83915-5979-4578-a621-0f39afc8dc45/endpoints/44772?use_server_proxy=false HTTP/1.1" 200
2026-04-02 15:44:08,380 - httpx - INFO - _client.py:1740 - HTTP Request: GET http://localhost:8080/v1/sandboxes/efd83915-5979-4578-a621-0f39afc8dc45/endpoints/44772?use_server_proxy=false "HTTP/1.1 200 OK"
2026-04-02 15:44:08,382 - code_interpreter.code_interpreter - INFO - code_interpreter.py:209 - Code interpreter efd83915-5979-4578-a621-0f39afc8dc45 created successfully
=== CodeInterpreter created! ===
2026-04-02 15:44:08,388 - httpx - INFO - _client.py:1740 - HTTP Request: POST http://127.0.0.1:53861/proxy/44772/code "HTTP/1.1 200 OK"
2026-04-02 15:44:16,125 - code_interpreter.adapters.code_adapter - ERROR - code_adapter.py:337 - Failed to run code (length: 107)
Traceback (most recent call last):
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpx/_transports/default.py", line 101, in map_httpcore_exceptions
yield
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpx/_transports/default.py", line 271, in aiter
async for part in self._httpcore_stream:
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 407, in aiter
raise exc from None
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 403, in aiter
async for part in self._stream:
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpcore/_async/http11.py", line 342, in aiter
raise exc
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpcore/_async/http11.py", line 334, in aiter
async for chunk in self._connection._receive_response_body(**kwargs):
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpcore/_async/http11.py", line 203, in _receive_response_body
event = await self._receive_event(timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpcore/_async/http11.py", line 213, in _receive_event
with map_exceptions({h11.RemoteProtocolError: RemoteProtocolError}):
File "/home/.pyenv/versions/3.11.7/lib/python3.11/contextlib.py", line 158, in exit
self.gen.throw(typ, value, traceback)
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.RemoteProtocolError: peer closed connection without sending complete message body (incomplete chunked read)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/code/OpenSandbox/sdks/code-interpreter/python/src/code_interpreter/adapters/code_adapter.py", line 314, in run
async for line in response.aiter_lines():
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpx/_models.py", line 1031, in aiter_lines
async for text in self.aiter_text():
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpx/_models.py", line 1018, in aiter_text
async for byte_content in self.aiter_bytes():
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpx/_models.py", line 997, in aiter_bytes
async for raw_bytes in self.aiter_raw():
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpx/_models.py", line 1055, in aiter_raw
async for raw_stream_bytes in self.stream:
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpx/_client.py", line 176, in aiter
async for chunk in self._stream:
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpx/_transports/default.py", line 270, in aiter
with map_httpcore_exceptions():
File "/home/.pyenv/versions/3.11.7/lib/python3.11/contextlib.py", line 158, in exit
self.gen.throw(typ, value, traceback)
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpx/_transports/default.py", line 118, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.RemoteProtocolError: peer closed connection without sending complete message body (incomplete chunked read)
Traceback (most recent call last):
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpx/_transports/default.py", line 101, in map_httpcore_exceptions
yield
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpx/_transports/default.py", line 271, in aiter
async for part in self._httpcore_stream:
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 407, in aiter
raise exc from None
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 403, in aiter
async for part in self._stream:
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpcore/_async/http11.py", line 342, in aiter
raise exc
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpcore/_async/http11.py", line 334, in aiter
async for chunk in self._connection._receive_response_body(**kwargs):
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpcore/_async/http11.py", line 203, in _receive_response_body
event = await self._receive_event(timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpcore/_async/http11.py", line 213, in _receive_event
with map_exceptions({h11.RemoteProtocolError: RemoteProtocolError}):
File "/home/.pyenv/versions/3.11.7/lib/python3.11/contextlib.py", line 158, in exit
self.gen.throw(typ, value, traceback)
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.RemoteProtocolError: peer closed connection without sending complete message body (incomplete chunked read)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/code/OpenSandbox/sdks/code-interpreter/python/src/code_interpreter/adapters/code_adapter.py", line 314, in run
async for line in response.aiter_lines():
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpx/_models.py", line 1031, in aiter_lines
async for text in self.aiter_text():
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpx/_models.py", line 1018, in aiter_text
async for byte_content in self.aiter_bytes():
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpx/_models.py", line 997, in aiter_bytes
async for raw_bytes in self.aiter_raw():
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpx/_models.py", line 1055, in aiter_raw
async for raw_stream_bytes in self.stream:
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpx/_client.py", line 176, in aiter
async for chunk in self._stream:
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpx/_transports/default.py", line 270, in aiter
with map_httpcore_exceptions():
File "/home/.pyenv/versions/3.11.7/lib/python3.11/contextlib.py", line 158, in exit
self.gen.throw(typ, value, traceback)
File "/home/code/OpenSandbox/.venv/lib/python3.11/site-packages/httpx/_transports/default.py", line 118, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.RemoteProtocolError: peer closed connection without sending complete message body (incomplete chunked read)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/code/OpenSandbox/examples/code-interpreter/main.py", line 129, in
asyncio.run(main())
File "/home/.pyenv/versions/3.11.7/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/home/.pyenv/versions/3.11.7/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/.pyenv/versions/3.11.7/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/code/OpenSandbox/examples/code-interpreter/main.py", line 62, in main
py_exec = await interpreter.codes.run(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/code/OpenSandbox/sdks/code-interpreter/python/src/code_interpreter/adapters/code_adapter.py", line 340, in run
raise ExceptionConverter.to_sandbox_exception(e) from e
opensandbox.exceptions.sandbox.SandboxInternalException: Unexpected SDK error occurred: peer closed connection without sending complete message body (incomplete chunked read)
Beta Was this translation helpful? Give feedback.
All reactions