File this under Weird: In Monterey copying a file with Finder corrupts the data in the target file

I have a really odd problem where files are being corrupted when I use Finder to copy them from my MacBook Air to my Mac Mini server. I only noticed this after seeing video glitches when I went to play the files back on my TV. When I compared the local files with their copies on the server, whole sections of data had been replaced with #00 characters.


If I generate an MD5 hash then I can check the copied file against the original, which in this case shows that the source and target files are clearly different. Initially I thought it might be a problem with my wireless network, but what is really weird is that when I copy the same file from the MacBook Air to a locally attached USB SSD drive then it is corrupted in the exact same way - the MD5 for the corrupted file on the SSD is the same value as the corrupted file on my server.


The source computer is an Intel MacBook Air running the most recent Mac OS Monterey 12.3.1. The server is an older Mac Mini running Catalina 10.15.7. I don't think the old software version on the server is a factor as the same corruption happens copying the file to a local USB SSD disk. Rsync copies the file correctly to the USB SSD Drive, so I think it's the Finder drag and drop that's causing the problem. I don't recall seeing this problem before upgrading the MacBook Air to Monterey.


Has anyone seen anything like this before?


Thanks for your help,


Steve

MacBook Air (2020 or later)

Posted on Apr 30, 2022 11:38 PM

Reply
Question marked as Top-ranking reply

Posted on Aug 25, 2022 3:56 PM

OK, here is what I am seeing. I used QBitTorrent to download the file Only.Murders.in.the.Building.S02E10.1080p.WEB.H264-CAKES[TGx]. The MD5 hash for the only.murders.in.the.building.s02e10.1080p.web.h264-cakes.mkv file is f63c9b25296bdbf4ae92640c5a65456a. If I use Finder to copy it onto my USB SSD drive, the MD5 for that file is d54e47ed0557d5239a3d656dd3831241, so clearly the files are different.


If I use cp or rsync to copy the local file onto my SSD drive it copies correctly with no corruption - they have same MD5 hash as the local file.


I opened a terminal window and use the cp command to create a duplicate copy of the original .mkv file which I called test.mkv, which has - as you would expect - the same MD5 hash as the original. If I copy this file to the SSD drive it copies correctly with no corruption. Let's try something else. I opened the original .mkv file in HexFiend and used the Save As option to duplicate it without editing it. Copying that duplicate file to the SSD works correctly too.


Copying the original .mkv file over to the SSD drive once more using Finder, I get exactly the same hash as the earlier corrupted copy, so it is being repeatably corrupted in exactly the same way. I renamed the original file and then used Finder to copy it and it was corrupted in exactly the same way.


So Finder is corrupting the file during the copy, but what does it actually look like? I wrote a program to compare the two files which produced this:


Size for both files is 1421335900 bytes

Matched 135139328 bytes from 1 to 135139329

Cleared 45056 bytes from 135139329 to 135184385

Matched 851968 bytes from 135184385 to 136036353

Cleared 40960 bytes from 136036353 to 136077313

Matched 82153472 bytes from 136077313 to 218230785

Cleared 4096 bytes from 218230785 to 218234881

Matched 28672 bytes from 218234881 to 218263553

Cleared 16384 bytes from 218263553 to 218279937

Matched 43192320 bytes from 218279937 to 261472257

Cleared 94208 bytes from 261472257 to 261566465

Matched 58478592 bytes from 261566465 to 320045057

Cleared 16384 bytes from 320045057 to 320061441

Matched 42364928 bytes from 320061441 to 362426369

Cleared 40960 bytes from 362426369 to 362467329

Matched 25534464 bytes from 362467329 to 388001793

Cleared 249856 bytes from 388001793 to 388251649

Matched 10924032 bytes from 388251649 to 399175681

Cleared 57344 bytes from 399175681 to 399233025

Matched 624123904 bytes from 399233025 to 1023356929

Cleared 20480 bytes from 1023356929 to 1023377409

Matched 397958492 bytes from 1023377409 to 1421335900 <EOF>

Processed 1421335900 bytes.


The pattern of the corruption is that every so often during the copy, large parts of the data are zeroed out in the target file. The file sizes are identical. But it doesn't happen on every file - just on the original file downloaded by qBitTorrent. You programmers might have noticed some hinky numbers there.


So the symptoms are:


  1. Using Finder to copy the file results in a corrupted target file (MD5 mismatch).
  2. Source and target file sizes are identical.
  3. Large sections of the target file have been zeroed out during the Finder copy.
  4. It is repeatable. If you copy the file using Finder once more it is corrupted identically (Same MD5 as the original copied corrupted file).
  5. If you duplicate the file (using cp), Finder will copy the duplicated file correctly.
  6. If you copy the file in a terminal window using cp or rsync it copies correctly.


If you are seeing this problem please report it to Apple so we can raise awareness of it and get it fixed.



Similar questions

57 replies
Question marked as Top-ranking reply

Aug 25, 2022 3:56 PM in response to Steve_Agnew_NZ

OK, here is what I am seeing. I used QBitTorrent to download the file Only.Murders.in.the.Building.S02E10.1080p.WEB.H264-CAKES[TGx]. The MD5 hash for the only.murders.in.the.building.s02e10.1080p.web.h264-cakes.mkv file is f63c9b25296bdbf4ae92640c5a65456a. If I use Finder to copy it onto my USB SSD drive, the MD5 for that file is d54e47ed0557d5239a3d656dd3831241, so clearly the files are different.


If I use cp or rsync to copy the local file onto my SSD drive it copies correctly with no corruption - they have same MD5 hash as the local file.


I opened a terminal window and use the cp command to create a duplicate copy of the original .mkv file which I called test.mkv, which has - as you would expect - the same MD5 hash as the original. If I copy this file to the SSD drive it copies correctly with no corruption. Let's try something else. I opened the original .mkv file in HexFiend and used the Save As option to duplicate it without editing it. Copying that duplicate file to the SSD works correctly too.


Copying the original .mkv file over to the SSD drive once more using Finder, I get exactly the same hash as the earlier corrupted copy, so it is being repeatably corrupted in exactly the same way. I renamed the original file and then used Finder to copy it and it was corrupted in exactly the same way.


So Finder is corrupting the file during the copy, but what does it actually look like? I wrote a program to compare the two files which produced this:


Size for both files is 1421335900 bytes

Matched 135139328 bytes from 1 to 135139329

Cleared 45056 bytes from 135139329 to 135184385

Matched 851968 bytes from 135184385 to 136036353

Cleared 40960 bytes from 136036353 to 136077313

Matched 82153472 bytes from 136077313 to 218230785

Cleared 4096 bytes from 218230785 to 218234881

Matched 28672 bytes from 218234881 to 218263553

Cleared 16384 bytes from 218263553 to 218279937

Matched 43192320 bytes from 218279937 to 261472257

Cleared 94208 bytes from 261472257 to 261566465

Matched 58478592 bytes from 261566465 to 320045057

Cleared 16384 bytes from 320045057 to 320061441

Matched 42364928 bytes from 320061441 to 362426369

Cleared 40960 bytes from 362426369 to 362467329

Matched 25534464 bytes from 362467329 to 388001793

Cleared 249856 bytes from 388001793 to 388251649

Matched 10924032 bytes from 388251649 to 399175681

Cleared 57344 bytes from 399175681 to 399233025

Matched 624123904 bytes from 399233025 to 1023356929

Cleared 20480 bytes from 1023356929 to 1023377409

Matched 397958492 bytes from 1023377409 to 1421335900 <EOF>

Processed 1421335900 bytes.


The pattern of the corruption is that every so often during the copy, large parts of the data are zeroed out in the target file. The file sizes are identical. But it doesn't happen on every file - just on the original file downloaded by qBitTorrent. You programmers might have noticed some hinky numbers there.


So the symptoms are:


  1. Using Finder to copy the file results in a corrupted target file (MD5 mismatch).
  2. Source and target file sizes are identical.
  3. Large sections of the target file have been zeroed out during the Finder copy.
  4. It is repeatable. If you copy the file using Finder once more it is corrupted identically (Same MD5 as the original copied corrupted file).
  5. If you duplicate the file (using cp), Finder will copy the duplicated file correctly.
  6. If you copy the file in a terminal window using cp or rsync it copies correctly.


If you are seeing this problem please report it to Apple so we can raise awareness of it and get it fixed.



Jun 4, 2022 3:15 PM in response to stephenfromno

Hi Stephen,


Can you try something for me to check if it is the same problem I am experiencing?


On your MacBook, choose one of the problem video files and copy it onto a USB drive, then run the cmp against that. If you find the files are different then you now have three video files, one good one on your MacBook and two corrupted video files, one on your USB disk and one on your NAS. What we want to do is to compare the two dud files to see if they have been corrupted the same way. You can compare them using cmp or by generating a hash value for each of the files.


Create an md5 hash file for each video file, say goodmd5.txt, usbmd5.txt and nasmd5.txt and compare them. In my case goodmd5.txt was different from nasmd5.txt, but nasmd5.txt and usbmd5.txt were identical, so finder corrupted the file in exactly the same way whether it was being copied to a local USB drive or across my wireless network.


Let me know what you find.


Even if you are copying the files over ethernet I would check them afterwards to make sure they copied correctly. I noticed the same problem copying flac files from one machine to another, so it isn't just a video file problem, probably a general file copy bug in finder. If it happens over ethernet as well that would be useful to know as I can't test that easily here.



Jun 4, 2022 5:07 AM in response to Steve_Agnew_NZ

Same problem here. It has taken 8 weeks to finally pinpoint the problem, i.e. Monterey 12.3 and using Finder to copy files from my MacBook to my NAS.


When using WiFi, files are copied successfully with exact same byte size. However, similar to OP, I started getting intermittent video glitches on my TV/NAS setup (which had been fine for 5 years) start, from approx early April onwards. I used 'cmp' to report the files are different, although byte count was the same


No video glitches when using ethernet to move the files from MB to NAS. 'cmp' reports files are identical.


Grrrrrrrr. As mentioned above, why doesn't Monterey 12.3 verify the file?




Jun 6, 2022 8:11 AM in response to Barney-15E

I am currently having this problem, after I copy a video file using finder it will not copy correctly, as confirmed with md5 check.


When I used terminal to copy with "ditto" command however it worked without issue. It is a completely new issue on a mac mini that I have been using for years. I thought it was external HD I was using so I got a new one but I have the same issue.

Jul 21, 2022 6:54 AM in response to Steve_Agnew_NZ

I'm definitely following this issue. I'm having the same problem. My regular scenario for years was moving files downloaded onto my Mac over to a network drive used by Plex. My family started complaining a couple months ago that videos were glitchy and I spent an embarrassing amount of time trying to figure out why. First maybe was it an issue with Plex but that wasn't it because playing the files directly off the drive without Plex Media Player would have the same glitches in the same place.


Ultimately, I did what you did which was to compare the hex in both files from my local drive on Mac to the network files (even though they were exactly the same size to the byte) and it was a mess. So the problem is exactly what you are describing with copying files from my local drive to network drive -- but mostly really big video files.


My temporary fix has been to download the files directly to the networked drive from my Mac without dealing with Finder. That has cleared everything up but it's a workaround to a silly problem.



Aug 23, 2022 6:06 AM in response to Brianrh7

My solution is that I use the old unix command cp from the terminal window. Use the -r flag to copy directories recursively (including all files and subdirectories). Here is how you do it:

  1. open terminal
  2. type "cp -r " (without the quotes)
  3. drag the file or directory you want to copy from the finder into the terminal window. The full path and filename should appear in the terminal.
  4. drag the destination drive or folder into the terminal. The path should appear as the second argument to the cp -r command.
  5. hit the return (enter) key
  6. wait until the copying is finished. You won't see any progress bar, but when it is done, your prompt will reappear in the terminal window.


May 1, 2022 7:17 PM in response to Steve_Agnew_NZ

I was having the exact same problem today while I was copying large video files to my TrueNAS server. After hours trying to figure it out the problem I stumbled upon your post and confirmed it was Finder corrupting my files. I made a simple test by copying a 1.5GB to a thumbdrive and boom, the file was corrupted. Compared both using the cli tool diff and they weren't the same file. Restarted the Macbook and now it works fine.

Jul 31, 2022 6:31 PM in response to Matti Haveri

Hi Matti,


Thanks for having a look.


It looks to me as though Apple have added a 'Copy but Corrupt It' option within Finder to prevent users easily sharing dodgy files. Files of random data copy just fine.


In my testing it only corrupts dodgy files that have been downloaded from the internet. You can copy the same dodgy file using Finder multiple times and to different destinations and the corrupted copies will all be identical. If you change the file even slightly - say prepending a couple of bytes to the start - the altered files will copy perfectly without being corrupted.


The option is probably triggered by a hash value - presumably from the first few chunks of the file so it can be corrupted during the copy. I don't know where the list of dodgy hashes is coming from - maybe the OS looks for files created by a torrent client or is downloading the hashes from somewhere else. They do seem to be stored on the local machine because the file copy is corrupted even if the local machine is offline when you perform the copy.


I did lodge a support call with Apple but they have since gone a bit silent on me which is I guess understandable if it isn't actually a bug.


Anyway there are other ways to copy files on OSX and I expect the Finder changes will be reverted eventually. After all, what could possibly go wrong with a 'Copy but Corrupt It' function built in to your OS?





Jul 31, 2022 9:12 AM in response to frankthewanderer

I did a short test but could not repeat the issue:


In macOS 12.5 I Finder-copied the same 1.86 GB .mp4 movie 9 times back-and-forth between Mac mini 2018 internal SSD and an external APFS SSD but the hashes seem to be the same (see below).


Can you repeat the issue at will? Does this happen only when Finder-copying to a server? Or to another folder or volume? Via USB or Ethernet or Wi-Fi? Which file system? How large files? What is the best and easiest way to verify the hash error, preferably between multiple files in input vs output folders?


ls -al
-rwxrwxrwx@ 1 *****  staff  1862672600 Jul 24 20:32 1_generation.mp4
-rwxrwxrwx@ 1 *****  staff  1862672600 Jul 24 20:32 9_generation.mp4

md5 1_generation.mp4
MD5 (1_generation.mp4) = 7dba3f80abc532570bd8954b14a7c0d9
md5 9_generation.mp4 
MD5 (9_generation.mp4) = 7dba3f80abc532570bd8954b14a7c0d9

shasum -a 512 1_generation.mp4 
16b6262e57b125cde2b0afee71b3a3fbfeadc16b9dd3a0dbd0678dfc4950fb39b205269c2d18e4330a92b21cef17e4309d3e7e31a1ae7de3dd5190b39ea06745  1_generation.mp4
shasum -a 512 9_generation.mp4 
16b6262e57b125cde2b0afee71b3a3fbfeadc16b9dd3a0dbd0678dfc4950fb39b205269c2d18e4330a92b21cef17e4309d3e7e31a1ae7de3dd5190b39ea06745  9_generation.mp4


Aug 24, 2022 10:02 AM in response to Steve_Agnew_NZ

Unfortunately, I have no solution. But this is the same problem I've been having since March 2022 (after I updated Monterey to 12.3). Hope this can shed some light on the problem at least.


I have a MacBook Air early-2020 (Model: A2179) and an iMac 2017 (Model: A1419, upgraded to 32GB RAM). Both installed with macOS 12.5.1 current, WiFi and wired network via AirPort Extreme (ME918Z/A) and AirPort Time Capsule (ME182Z/A).


This error occurs on both Macs, I have three LaCie d2 10TB external drives (series linked via Thunderbolt 3), one LaCie 2big RAID 28TB (USB-C) and one NAS Synology DS920+ 64TB (Wired network cable) all drives are Seagate IronWolf Pro HardDrives as all formatted to APFS except NAS which is Synology's "BtrFs" format as JBOD.


I've spent countless hours trying and troubleshooting, unplugging one drive after another, but then after a while, it happens again. Tried on both MacBook and iMac, happens anyway after a while. Can't find any pattern, other that if I copy a file to another disk, I never know if it's broken unless I test it extensively. I move many 100 video files in from large projects, and do not have any opportunity to check each individual file after transfer. Have lost over 20TB of footage and at least 1k working hours of edited video material which is now lost forever. Because I found out after a while that the copying had failed, but after deleting the originals. 🙈 So I have not been able to work properly since I found this out since March 2022. All my work is at hold, since I can't use the disks as they should. Even sent a drive to Seagate to use their recovery service and have the drive replaced, as I was sure it was the one causing all the problems. To discover soon after, that the problem was still there! I have also sent in the iMac for service, but the Apple workshop found no faults and did not change anything. Again costing me precious time and money. Googled for many hours to find something about this, but never found any useful info until this thread. 😉 Also spent several tens of hours with Seagate customer service. Seagate has really tried everything, as I was sure it was the drives until recently (now). But it makes sense that this could be a software error, so now the iMac should be downgraded to MacOS Big Sur asap. So maybe this will finally stop 👌, as I don't dare move a single file as it is now. Also spent countless hours on troubleshooting, becoming increasingly puzzled as the error occurs on all disks, but never know when and where it happens.


The only pattern I've seen is that it doesn't happen right away right after a reboot/or recently connected an external disk. And that it mainly applies to video files. When the error first occurs, if I copy the same file to each of the disks: all will contains the exact same error (for example missing 5 frames after 30 seconds) on each of the files on all the disks even the original file are fine! If I unmount the source disk, and unplug the power for 10 seconds. Then I connects again, then everything works perfectly fine again until suddenly it happens again. 🤯 And the file can be copied to any disk without missing the same error as in the example. It can take 10 minutes after you connect a USB disk, or it can take a week. But happens every time I move somewhat large projects etc (as several hundred GB or a few TB).


Incredibly frustrating, this is what I mainly do om my iMac/LaCie drives and have all this expensive equipment for. This error has made everything worthless to me. I have no words for how frustrated I am. Have almost exclusively used a mac since 2007, if it turns out that this is a software error. Then they have at the very least suffered a setback in my eyes Sorry for my bad Norwegian-English.

Jul 8, 2022 9:37 PM in response to macsnotgnu

Does it work properly if you use cp to copy the files? It would good to have another person that can point to a possible problem in finder. I’m onlyusing rsync because I haven’t used cp before.


I have sent some examples and analytics to Apple Support - haven’t heard back for a couple of weeks but the person I was talking to could see how serious a problem it might be. My case ID is 101725043882 if you want to contact them yourself.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

File this under Weird: In Monterey copying a file with Finder corrupts the data in the target file

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.