Just change the viewid part of your item db entries to match whatever you have in the lua.
For that character that is still erroring:
Say....If your cowring hat's view id before was 1000, once you equip that item that viewid is saved somewhere in your server files. Now say in your lua you change the view id of cowring to 2000, now if you try to log in the character equipped before with the cowring (saved in character data as viewid 1000), you'll get an error because the server stores your view id as 1000 for cowring instead of 2000. To fix this problem, you'd have to edit certain entries in your server files. I can't tell you right now exactly which since I'm not running txt. i suggest you look in your save folder though that lists all the characters and set the view id in there to 0.
Hopefully, that's easy to understand.