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
FileExistsError on Windows when writing history backup file #41
`write_json_file` in `core/init.py` (called from `persist_requests`, which every successful request triggers) writes history atomically via a temp file renamed to a `.bkp` backup path:
```
File "core/init.py", line 407, in write_json_file
FileExistsError: [WinError 183] Cannot create a file when that file already exists: '...\Packages\User\Requester.history.json' -> '...\Packages\User\Requester.history.json.bkp'
```
`os.rename()` on POSIX silently overwrites an existing destination; on Windows it raises `FileExistsError` instead if the destination already exists. Since `Requester.history.json.bkp` already existed on this machine from a prior run, the very next request crashed here.
Reproduction: run any request once (creating `Requester.history.json.bkp`), then run a second request -- the second one hits the `.bkp` rename and raises.
The exception doesn't visibly break the visible request/response flow (the response tab still renders correctly), so it's easy to miss unless the console is checked -- this was found via a full console read, not a failed request.
Suggested fix: use `os.replace()` instead of `os.rename()` for the backup step -- `os.replace()` is documented to overwrite an existing destination atomically on both POSIX and Windows.
Activity