If you see error -54 when you sync with iTunes
https://support.apple.com/HT205597
From an OS9 reference, error -54 is a software lock on a file or a permissions error. (Although there is no formal list of OSX error code some of the old codes still apply to OSX .)
First, try simply restarting your computer.
Try quitting iTunes, then deleting the .xml (not .itl !) version of the library file in the iTunes folder (iTunes will generate a new one).
iTunes Library cannot be saved (Error -54) - https://discussions.apple.com/thread/1912814 - various things to try.
Unknown error (-54) while syncing ipod - https://discussions.apple.com/thread/1082953 - problem was locked files
Mar. 2016 LincDavis post: https://discussions.apple.com/message/29951885#29951885
Why does iTunes keep showing a -54 error when I sync my iPad? - https://discussions.apple.com/thread/3727114
Apr. 2016 Unknown Sync error occurred (-54) - https://discussions.apple.com/thread/7245433 - Problem was iBooks
April 2018 - Attempting to copy to the disk "Macintosh HD" failed. An unknown error occurred (-54). Message while syncing iPhone to computer. - https://discussions.apple.com/thread/8326991 - Re-authorise Mac