diff --git a/solstone/apps/sol/maint/009_remove_granola_sync_schedule.py b/solstone/apps/sol/maint/009_remove_granola_sync_schedule.py index 982163683..a3b140666 100644 --- a/solstone/apps/sol/maint/009_remove_granola_sync_schedule.py +++ b/solstone/apps/sol/maint/009_remove_granola_sync_schedule.py @@ -85,7 +85,7 @@ def run_migration(*, dry_run: bool) -> MigrationSummary: try: raw = json.loads(raw_bytes) - except json.JSONDecodeError: + except (UnicodeDecodeError, json.JSONDecodeError): summary.skipped_reason = "unparseable" return summary diff --git a/tests/test_maint_009_remove_granola_sync_schedule.py b/tests/test_maint_009_remove_granola_sync_schedule.py index efdc3e910..307713e63 100644 --- a/tests/test_maint_009_remove_granola_sync_schedule.py +++ b/tests/test_maint_009_remove_granola_sync_schedule.py @@ -250,6 +250,7 @@ def test_second_run_is_noop_and_does_not_rewrite_schedules_file(tmp_path): pytest.param(None, "no file", id="missing-file"), pytest.param(b"", "empty file", id="empty-file"), pytest.param(b"{not json", "unparseable", id="non-json"), + pytest.param(b"\xff\xfe\x00", "unparseable", id="invalid-utf8"), pytest.param(b"[]", "unparseable", id="non-dict"), ], )