Skip to content

Your lightweight open-source personal agent.

fix(agent): handle UnicodeDecodeError in _read_last_entry

chengyongru69d60e2b063b
diff --git a/nanobot/agent/memory.py b/nanobot/agent/memory.py
index 26c5cd45f..e9662ff2c 100644
--- a/nanobot/agent/memory.py
+++ b/nanobot/agent/memory.py
@@ -290,7 +290,7 @@ class MemoryStore:
if not lines:
return None
return json.loads(lines[-1])
- except (FileNotFoundError, json.JSONDecodeError):
+ except (FileNotFoundError, json.JSONDecodeError, UnicodeDecodeError):
return None
def _write_entries(self, entries: list[dict[str, Any]]) -> None: