Skip to content

SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]

fix `docker.errors.NotFound` (#587)

Kilian Lieret077fdc4c92a6
diff --git a/docs/config/env.md b/docs/config/env.md
index 00df9558..4de66032 100644
--- a/docs/config/env.md
+++ b/docs/config/env.md
@@ -16,4 +16,4 @@ This page details all environment variables that are currently in use by SWE-age
* `SWE_AGENT_COMMUNICATE_METHOD`: Determines how SWE-agent communicates with the running process in the docker container: `end-marker` (default, fast) or `processes` (legacy, slow, more tested)
* `SWE_AGENT_CLONE_METHOD`: `sparse` (default) or `full`. When using persistent containers or running over multiple problem statements, we fall back to `full`.
-* `SWE_AGENT_DOCKER_START_UP_DELAY`: Number of seconds to wait after starting a docker container
\ No newline at end of file
+* `SWE_AGENT_DOCKER_START_UP_DELAY`: Number of seconds to wait after starting a docker container
diff --git a/sweagent/environment/swe_env.py b/sweagent/environment/swe_env.py
index 926d2cb5..cb387ded 100644
--- a/sweagent/environment/swe_env.py
+++ b/sweagent/environment/swe_env.py
@@ -520,6 +520,10 @@ class SWEEnv(gym.Env):
self.container_obj.remove(force=True)
except KeyboardInterrupt:
raise
+ except docker.errors.NotFound:
+ # We already tried to exit the container, so it's actually good if
+ # it's not found
+ pass
except Exception:
self.logger.warning("Failed to remove container", exc_info=True)
else: