It's an error with TalkImg, maybe load related (or joker_josue is trying to fix CORS while we're talking, which would make the script work without my proxy).
I was able to skip the error and rerun the script.
Most possibly when it finds a topic which is locked then from the next step it starts working and shows error.
In my case the error was on the 33rd page [const startPage = 33]
Then I thought to skip the page and started from 34th page [const startPage = 34]
It worked until I got the same error on 78th page.
[60454365] Uploading image... debugger eval code:138:25
[60454365] Uploaded: https://talkimg.com/images/2023/05/14/blob55aa087fccffd7d7.jpeg debugger eval code:143:29
[60454365] Editing post https://bitcointalk.org/index.php?topic=5404157.msg60454365#msg60454365 debugger eval code:156:25
[60454365] Could not edit post (maybe locked?), deleting uploaded images...
Again skipped the error page and started from 79th page [const startPage = 34]
It working.
Hopefully it will help for those who are seeing error after running the script for a few minutes.