I’ve noticed that
folder.getEntries() throws an error if the folder contains invisible OSX items, as when folders have custom icons assigned.
this folder has a custom icon (cmd + shift + . to show/hide hidden items):
The error is:
Error: no such file or directory] code: -2
This folder has the default icon:
In this case,
folder.getEntries() is executed correctly.
OSX version: Catalina 10.15.1