Ajax validation only works when I am logged in as an administrator
These kind of errors often happen when you have not attached the proper library to your form. So one thing to check is if you have $form['#attached']['library'][] = 'core/drupal.dialog.ajax'; in your form's buildForm().