You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Corrupt settings file is silently overwritten with defaults, losing presets and hotkeys #65
If autoclicker_settings.json is ever unreadable (a hand edit with a trailing comma, a disk hiccup, an antivirus quarantine), the app quietly starts with defaults and the next save overwrites the file, permanently deleting the user's presets and custom hotkeys. Saves happen often (theme toggle, target mode change, every Start, on exit), so the loss happens within seconds and the only trace is a warning in autoclicker.log. The README actively invites editing the file ("All settings keys", e.g. max_cps_ceiling), which makes this more likely.
Evidence
autoclicker/core/settings_manager.py:105-118: on json.JSONDecodeError or a non-object, log a warning and return defaults.
SettingsManager.set / update (lines 131-139) immediately save the whole in-memory dict via atomic_write_json, replacing the bad file.
Loaded values are merged without type checks ({**self._defaults(), **loaded_settings}), so e.g. "presets": [] or "hotkeys": "F6" from a hand edit flows into PresetManager / HotkeyManager and fails later in less obvious places.
Suggested approach
On a parse failure, rename the bad file to autoclicker_settings.json.corrupt-<timestamp> before using defaults, and say so once in the status bar ("Settings file was unreadable; saved a copy as ...").
Per key, replace values of the wrong type with the default and log it, instead of trusting the file wholesale.
Optional: keep one rolling autoclicker_settings.json.bak written before each save.
Done when
A corrupt settings file is preserved on disk, never silently overwritten, and the user is told where it went.
Wrong-typed keys fall back per key without crashing.
Activity