diff --git a/aider/models.py b/aider/models.py index 3c85b73e5..7eb022681 100644 --- a/aider/models.py +++ b/aider/models.py @@ -153,7 +153,11 @@ class ModelInfoManager: if self.cache_file.exists(): cache_age = time.time() - self.cache_file.stat().st_mtime if cache_age < self.CACHE_TTL: - self.content = json.loads(self.cache_file.read_text()) + try: + self.content = json.loads(self.cache_file.read_text()) + except json.JSONDecodeError: + # If the cache file is corrupted, treat it as missing + self.content = None except OSError: pass