From 81a7442d7aae5844200eded4eea3cba1d06d6f24 Mon Sep 17 00:00:00 2001 From: Dylan De Faoite Date: Thu, 19 Feb 2026 14:25:37 +0000 Subject: [PATCH] fix: add check for state file in load_state --- rewind/state.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rewind/state.py b/rewind/state.py index 567b08a..da4052d 100644 --- a/rewind/state.py +++ b/rewind/state.py @@ -16,7 +16,11 @@ def get_state_file_path() -> Path: return get_state_dir() / STATE_NAME def load_state() -> dict: - with get_state_file_path().open() as f: + path = get_state_file_path() + if not path.exists(): + return EMPTY_STATE.copy() + + with path.open() as f: return json.load(f) def write_state(state: dict) -> None: