Merge "Add error handling to prevent IllegalArgumentException" into main