E2B icon indicating copy to clipboard operation
E2B copied to clipboard

Peer closed connection without sending complete message body

Open anujfulari opened this issue 3 months ago • 4 comments

Describe the bug I am consistently getting this error when running E2B sandbox with template which installs Pandas library for python:

peer closed connection without sending complete message body (incomplete chunked read)

To Reproduce Steps to reproduce the behavior:

with Sandbox.create(timeout=timeout, template=sandbox_template) as sandbox:
    execution = sandbox.run_code(code) # Any pandas df code

Version e2b-code-interpreter==2.0.0 python==3.11.13

Traceback

Traceback (most recent call last):
  File "mypath\Lib\site-packages\httpx\_transports\default.py", line 101, in map_httpcore_exceptions
    yield
  File "mypath\Lib\site-packages\httpx\_transports\default.py", line 127, in __iter__
    for part in self._httpcore_stream:
  File "mypath\Lib\site-packages\httpcore\_sync\connection_pool.py", line 407, in __iter__
    raise exc from None
  File "mypath\Lib\site-packages\httpcore\_sync\connection_pool.py", line 403, in __iter__
    for part in self._stream:
  File "mypath\Lib\site-packages\httpcore\_sync\http11.py", line 342, in __iter__
    raise exc
  File "mypath\Lib\site-packages\httpcore\_sync\http11.py", line 334, in __iter__
    for chunk in self._connection._receive_response_body(**kwargs):
  File "mypath\Lib\site-packages\httpcore\_sync\http11.py", line 203, in _receive_response_body
    event = self._receive_event(timeout=timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "mypath\Lib\site-packages\httpcore\_sync\http11.py", line 213, in _receive_event
    with map_exceptions({h11.RemoteProtocolError: RemoteProtocolError}):
  File "mypath\Lib\contextlib.py", line 158, in __exit__
    self.gen.throw(typ, value, traceback)
  File "mypath\Lib\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 "<string>", line 1, in <module>
  File "mypath\Lib\site-packages\e2b_code_interpreter\code_interpreter_sync.py", line 210, in run_code
    for line in response.iter_lines():
  File "mypath\Lib\site-packages\httpx\_models.py", line 929, in iter_lines
    for text in self.iter_text():
  File "mypath\Lib\site-packages\httpx\_models.py", line 916, in iter_text
    for byte_content in self.iter_bytes():
  File "mypath\Lib\site-packages\httpx\_models.py", line 897, in iter_bytes
    for raw_bytes in self.iter_raw():
  File "mypath\Lib\site-packages\httpx\_models.py", line 951, in iter_raw
    for raw_stream_bytes in self.stream:
  File "mypath\Lib\site-packages\httpx\_client.py", line 153, in __iter__
    for chunk in self._stream:
  File "mypath\Lib\site-packages\httpx\_transports\default.py", line 126, in __iter__
    with map_httpcore_exceptions():
  File "mypath\Lib\contextlib.py", line 158, in __exit__
    self.gen.throw(typ, value, traceback)
  File "mypath\Lib\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)

anujfulari avatar Sep 27 '25 07:09 anujfulari

e2b.Dockerfile:

FROM e2bdev/code-interpreter:latest

RUN pip install --no-cache-dir pandas

anujfulari avatar Sep 27 '25 07:09 anujfulari

Running into the same issue. Re-generate the template with RUN pip install --no-cache-dir pandas does not solve the issue. This happens 100% of the time and is a recent regression. There has not been changed in our template.

ethansmith91 avatar Sep 29 '25 18:09 ethansmith91

+1

zixinh avatar Oct 02 '25 02:10 zixinh