diff --git a/hermes_cli/auth.py b/hermes_cli/auth.py index 0a472f2d8..00685436d 100644 --- a/hermes_cli/auth.py +++ b/hermes_cli/auth.py @@ -743,7 +743,18 @@ def _load_auth_store(auth_file: Optional[Path] = None) -> Dict[str, Any]: try: raw = json.loads(auth_file.read_text()) - except Exception: + except Exception as exc: + corrupt_path = auth_file.with_suffix(".json.corrupt") + try: + import shutil + shutil.copy2(auth_file, corrupt_path) + except Exception: + pass + logger.warning( + "auth: failed to parse %s (%s) — starting with empty store. " + "Corrupt file preserved at %s", + auth_file, exc, corrupt_path, + ) return {"version": AUTH_STORE_VERSION, "providers": {}} if isinstance(raw, dict) and (