code: public FormValidation doCheckName(@QueryParameter String value) throws IOException, ServletException {
          Jenkins.getInstance().checkPermission(Computer.CREATE);
  
          if(Util.fixEmpty(value)==null)
              return FormValidation.ok();
          
          try {
              checkName(value);
              return FormValidation.ok();
          } catch (Failure e) {
              return FormValidation.error(e.getMessage());
          }
      }
docs: Makes sure that the given name is good as an agent name.