Seriously, Drupal, what the hell?
This code is the callback for an #ajax property on a form element. The HTML returned replaces the HTML provided. That all works. What gets tricky is the form validation function being called and getting the error.