princeton-nlp / SWE-agent

SWE-agent takes a GitHub issue and tries to automatically fix it, using GPT-4, or your LM of choice. It solves 12.47% of bugs in the SWE-bench evaluation set and takes just 1 minute to run.
https://princeton-nlp.github.io/SWE-agent/
MIT License
11.86k stars 1.18k forks source link

` docker.errors.NotFound` when encountering exceptions #586

Closed klieret closed 2 weeks ago

klieret commented 2 weeks ago

Currently encountered when a command in the container files or similar

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/docker/api/client.py", line 275, in _raise_for_status
     response.raise_for_status()
   File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/requests/models.py", line 1024, in raise_for_status
     raise HTTPError(http_error_msg, response=self)
 requests.exceptions.HTTPError: 404 Client Error: Not Found for url:
 http+docker://localhost/v1.45/containers/f2aa44e94a8f1e23796298c2f8dbdd16bab93d3674fb792009649ca481135ef7?v=False&link=False&force=True

 The above exception was the direct cause of the following exception:

 Traceback (most recent call last):
   File "/home/klieret/SWE-agent/sweagent/environment/swe_env.py", line 520, in close
     self.container_obj.remove(force=True)
   File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/docker/models/containers.py", line 367, in remove
     return self.client.api.remove_container(self.id, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/docker/utils/decorators.py", line 19, in wrapped
     return f(self, resource_id, *args, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/docker/api/container.py", line 1037, in remove_container
     self._raise_for_status(res)
   File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/docker/api/client.py", line 277, in _raise_for_status
     raise create_api_error_from_http_exception(e) from e
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/docker/errors.py", line 39, in create_api_error_from_http_exception
     raise cls(e, response=response, explanation=explanation) from e
 docker.errors.NotFound: 404 Client Error for http+docker://localhost/v1.45/containers/f2aa44e94a8f1e23796298c2f8dbdd16bab93d3674fb792009649ca481135ef7?v=False&link=False&force=True:
 Not Found ("No such container: f2aa44e94a8f1e23796298c2f8dbdd16bab93d3674fb792009649ca481135ef7")
klieret commented 2 weeks ago
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
INFO     Beginning environment shutdown...
WARNING  Failed to remove container
Traceback (most recent call last):
 File "/home/klieret/SWE-agent/run.py", line 377, in main
   self.run(index)
 File "/home/klieret/SWE-agent/run.py", line 341, in run
   observation, info = self.env.reset(index)
                       ^^^^^^^^^^^^^^^^^^^^^
 File "/home/klieret/SWE-agent/sweagent/environment/swe_env.py", line 372, in reset
   self.install_env()
 File "/home/klieret/SWE-agent/sweagent/environment/swe_env.py", line 988, in install_env
   self.communicate_with_handling(
 File "/home/klieret/SWE-agent/sweagent/environment/swe_env.py", line 747, in communicate_with_handling
   raise RuntimeError(msg)
RuntimeError: Install command failed to execute successfully: Obtaining file:///pvlib__pvlib-python

(...)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
 File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/docker/api/client.py", line 275, in _raise_for_status
   response.raise_for_status()
 File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/requests/models.py", line 1024, in raise_for_status
   raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url:
http+docker://localhost/v1.45/containers/f2aa44e94a8f1e23796298c2f8dbdd16bab93d3674fb792009649ca481135ef7?v=False&link=False&force=True

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
 File "/home/klieret/SWE-agent/sweagent/environment/swe_env.py", line 520, in close
   self.container_obj.remove(force=True)
 File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/docker/models/containers.py", line 367, in remove
   return self.client.api.remove_container(self.id, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/docker/utils/decorators.py", line 19, in wrapped
   return f(self, resource_id, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/docker/api/container.py", line 1037, in remove_container
   self._raise_for_status(res)
 File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/docker/api/client.py", line 277, in _raise_for_status
   raise create_api_error_from_http_exception(e) from e
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/docker/errors.py", line 39, in create_api_error_from_http_exception
   raise cls(e, response=response, explanation=explanation) from e
docker.errors.NotFound: 404 Client Error for http+docker://localhost/v1.45/containers/f2aa44e94a8f1e23796298c2f8dbdd16bab93d3674fb792009649ca481135ef7?v=False&link=False&force=True:
Not Found ("No such container: f2aa44e94a8f1e23796298c2f8dbdd16bab93d3674fb792009649ca481135ef7")
klieret commented 2 weeks ago

Ah, this is because we already exit the running process before, so it's most likely closed