NSItemProvider.loadFileRepresentation Error when sharing from Photos

When trying to copy photos from the Photos app using my Share Extension I am regularly getting an error:

Error copying file type public.jpeg. Error: Error Domain=NSItemProviderErrorDomain Code=-1000 "Cannot load representation of type public.jpeg" UserInfo={NSLocalizedDescription=Cannot load representation of type public.jpeg, NSUnderlyingError=0x117f16640 {Error Domain=NSItemProviderErrorDomain Code=-1 "Cannot copy file at URL  ...[].jpg., NSUnderlyingError=0x117f45ce0 {Error Domain=NSItemProviderErrorDomain Code=-1 "Cannot create a temporary file. Error: Undefined error: 0" UserInfo={NSLocalizedDescription=Cannot create a temporary file. Error: Undefined error: 0}}}}}

I have seen this error elsewhere on the forums linked to PHPickerViewController and bug 64630315.

Bug 64630315 is claimed fixed on iOS, but might it still be an issue on macOS? My Share Extension works correctly on iOS.

On macOS I see this error when trying to share photos that I didn't take, but have been added to my library manually, via WhatsApp for example. Everything works as expected when sharing Live or Portrait images taken by me. I am trying to share as jpg.

Photos that fail on macOS share as expected on iPhone from the same library.

NSItemProvider.loadFileRepresentation Error when sharing from Photos
 
 
Q