invalid data updating form error when updating textvalidation of item

I use the following code to update textvalidation with a string: function updateform(strtokens) { var form = FormApp.openById(#formid#); var textItem = form.getItemById(#formid#); var textValidation = FormApp.createTextValidation() .requireTextMatchesPattern(strtokens) .build(); textItem.asTextItem().setValidation(textValidation); return form.getPublishedUrl(); } I get error saying “invalid data updating form” at line textItem.asTextItem().setValidation(textValidation) I get this issue on occasion but not all the time and…

Details