Skip to content

The agent that grows with you

fix(state): let sqlite raise the canonical error for a directory db_path

teknium1d21913b09cce
diff --git a/contributors/emails/hermes-fleet-fix@localhost b/contributors/emails/hermes-fleet-fix@localhost
new file mode 100644
index 00000000000..183f2f36518
--- /dev/null
+++ b/contributors/emails/hermes-fleet-fix@localhost
@@ -0,0 +1 @@
+rohitsabu
diff --git a/hermes_state.py b/hermes_state.py
index 2f9d621303e..8bec8e91f13 100644
--- a/hermes_state.py
+++ b/hermes_state.py
@@ -248,6 +248,10 @@ def _secure_state_db_files(db_path: Path, *, create_main: bool = False) -> None:
fd = os.open(path, flags, 0o600)
except FileNotFoundError:
continue
+ except IsADirectoryError:
+ # Not a database file at all; sqlite3.connect() raises the
+ # canonical error for this, and a directory leaks no row data.
+ continue
try:
os.fchmod(fd, 0o600)
finally: