Improved error handling for raw creation