Why do I get “Operation not permitted” when scanning ~/Library/Mail ?

If you select the ~/Library/Mail directory as a source (where ~ represents your home directory), the sync should run without issues. On the other hand, selecting one of its ancestors, like ~/Library, can cause scan errors.

In general, selecting a directory in an open panel grants an app access to all subfiles and subdirectories, but there are some exceptions. An Apple engineer mentions this exact use case on the Apple Developer Forums, confirming that selecting ~/Library does not automatically grants access to ~/Library/Mail. The solution is to select ~/Library/Mail directly as the source.