How do I solve the error “Setting the custom file icon failed”?

This error usually happens when the destination volume doesn’t support custom file icons. You can check if the destination volume supports custom file icons by manually setting one in the Finder.

Custom directory icons can be set in the Finder by opening the Info panel (from the main menu View > Get Info, or by pressing Command-I) and dragging an image onto the icon on the top left of the Info panel. A custom icon can be removed again by clicking it in the Info panel and pressing the Delete key.

Check for custom file icons

If you’re getting the error “Setting the custom file icon failed” but you cannot see a custom icon in the Finder on the source, you can check if there is a custom icon with the following steps:

  1. Open the Terminal (in /Applications/Utilities).
  2. Type “ls -a ” (with a trailing whitespace), then drag the directory mentioned in the error message into the Finder window. Press Enter. This command lists all contents of the dragged directory, including hidden files. A custom directory icon is saved inside the directory itself as a hidden file named “Icon\r”, where “\r” stands for the carriage return character and is displayed in the Finder as a “?” character.

Delete custom file icons

You can find and optionally delete all the custom icons on the source with the following steps:

  1. Open the Terminal (in /Applications/Utilities).
  2. Type “cd ” (with a trailing whitespace), then drag the root directory into the Finder window. Press Enter. This command makes the dragged directory the current directory in the Terminal.
  3. Copy and paste the command
    find . -name "Icon?" -type f
    into the Terminal window and press Enter. This command lists all files with the name “Icon”, followed by any other character. In the find command, ? matches any character, which we use to replace the “\r” character.
  4. Make sure that no unwanted file is listed.
  5. Copy and paste the command
    find . -name "Icon?" -type f -delete
    into the Terminal window and press Enter. This command deletes all files matched by the previous query.

Avoid syncing custom directory icons

Please have a look at this help topic: How can I avoid syncing custom directory icons?