MacOS – Recurring “error code -50/invalid argument” resolved by reboot, better solution sought

disk-utilityibookmacos

I'm using an old iBook G4 (PowerPC) running Tiger to serve iTunes to the house. For the past week or so, the mac boots fine, and then sometime during the day starts generating

An unexpected error occurred (error code -50).

errors when iTunes attempts to save its library file.

Checking reveals that the boot drive (main drive, in the laptop) behaves as if it is write-protected – I get the same error code when I attempt to create a folder on the desktop, for instance. If I attempt to create files via the terminal, e.g. via
ls > foo.txt
I get an "invalid argument" error.

I've set the iBook to run in Target Disk Mode and run Disk Utility to repair the disk (from a Macbook running Snow Leopard) and get "The volume appears to be ok".

I don't have the option in Disk Utility to Repair Permissions in Target Disk Mode. When I ran Repair Permissions on the iBook itself, it came back with no errors, no permissions corrected, but did not in fact fix the problem.

Rebooting always solve the problem – for the next 5-10 hours or so.

Would Disk Warrior help, or some other software fix, or is it time to buy a new drive? (And, in any case, what's going wrong?)

Best Answer

Error 50 is a generic - iTunes has failed to write a file and the article listing specific store errors (expand the section on Specific Conditions and Alert Messages to reveal -50 in that section) deals with the usual problems where the store is failing or the network is failing.

If the error is bubbling up from the filesystem (or you get the error from Finder), then it's often an "illegal" character in the file or folder name. Look to remove or rename files with emoji, unicode characters or more mundane characters like : & or /

In your case, it's very likely the drive is the cause. You can and should look in the console app to see what other errors happen around that time. Look for I/O errors - disk0 - or just run disk utility and have it verify / repair the catalog file. This will confirm the guess that the drive is failing and the errors are not some software problem.

You could export the current library xml to the desktop and start over with a brand new iTunes library file just to rule out corruption in that file, but then you would have two problems at the same time - terminal unable to write a file and iTunes unable to write a file. Occam's razor (and my experience) says it's the filesystem/drive - not two identical software problems.

Spinning hard drives do track the sectors where a bad write has happened and try to keep track of them so the system won't notice files not vein written, but as a drive ages (or if this mechanism fails) you will get unrecoverable errors more and more.

Also - it's often hard to tell if the catalog structure is bad (which Disk Warrior, Drive Genius and plain old erase in Disk Utility attempt to fix assuming the drive works properly). But if the underlying hardware is failing, you'll need to move to a new drive.

I would just make another backup and zero the drive and look for errors during the zero / reinstall. If the errors persist, it's time for a new drive once the pain of reboots is more than the cost of a new part costs.

In your specific case of an old PPC machine where repair is invasive and the cables likely to be brittle, I would just re-install the OS onto an inexpensive and many GB external drive and run the mac from a cheap USB drive (most iBooks will boot from USB, but not all will) - leaving the potentially failing internal drive sitting unused, unmounted and spun down. It's rare for a failed drive to take down the machine so you can just leave it alone for minimal cost if you can tolerate the iBook running on an external drive.