Apparently the error is misleading, because even though it explicitly mentions that my app can not access the target directory, the issue was actually with my source file. Adding the following to the begging of my copy function solved the issue:
guard file.startAccessingSecurityScopedResource()
else { throw FileError.noPermission }
defer {
file.stopAccessingSecurityScopedResource()
}