After a lot of debugging, it turns out that the solution is absurdly simple.
Ensure that the entire "calibre library" folder tree is not read-only.
In windows:
Calibre Portable\Calibre Library>attrib -r *.* /d /s
In other words: open a cmd prompt.
go to your Calibre Library folder
Type
attrib -r *.* /d /s
- Attrib: Set attributes
- -r: Turn or Read-only
- /s: do subfolders
- /d: Processes directories as well.
Good luck.