Improve error handling in inventory update