Ok all, I have a strange and potentially problematic issue.
Background: Recently upgraded to thee latest 10.5 iTunes along with OSX 10.7.2 and iOS 5 on my iPhone. My iTunes library is large - almost 300,000 songs, but have not had any issues until after the upgrade - except for the sluggishness of the progam (which apprears to be normal once you reach a certain point) as well as limitations with Genuis which I've not been able to resolve in any version. I also have a fairly elaborate Playlist setup which I've refined over the past couple of years. My iTunes library resides lookly in the default location under Music and the Media Folder sits on 3TB external. Note that everything has worked fine up until now...
Anyway, this is just a quick background - and also to set the stage for any suggestions that might involve a 'random' rebuild of the iTunes library as it would involve a massive effort.
Problem: Very intermittantly while playing music I will get an error pop up "Itunes library cannot be saved. A folder was specified instead of a file". Otherwise everything appears working - playcounts are updated and reflected in my SmartPlaylist while I pay, lyrics seem to be added as I play (via TuneText), etc - and all syncs fine with the iPhone.
Now if I shut down iTunes when this happens and try and reopen, I will get the error "The iTunes Application cannot be opened, an unknown error occured (13014)." Now if I look at the permissions of the iTunes Library database it shows "You have unknown access". Note the permissions of all other files are ok.
In the past to correct this I've pulled back an earlier version of the Library from my Time Machine which of course is not ideal. I've also set up a parallel library about a year ago which can open fine (I use this other one to stage the music before importing into my main one in that the main is too slow to edit anything major).
So far I've tried Repairing Permissions and reinstalling the iTunes.app but the intermittant problem is not resolved.
I had the exact same problem. Been trying to figure this one out for quite a while. But for me the following worked. Hope I can explain this clearly.
I've created a new user account on my mac, gave it administrator permissions. Logged out from my own account and logged in with the new.
After that I've accessed the iTunes folder of my own account. You can access this with the password of the new account.
Then I sellected the iTunes folder, "cmd i" and gave my own and new account Read & Write access and gave "everyone" No Access. I sellected on the bottom of the information window "apply to enclosed items".
Close the information window and log back in with your own account. Now you will have full access again.
After that you can delete the new made account.
Let me know if this works for you.