Q:

How do to resolve this error "Exception: Invalid argument: replacement"?

I have a function that makes a copy of an existing document (template) and then merges data in dynamically by matching the header names to the tags listed within the document. The function worked without any problems, but now suddenly I'm receiving an error message whenever it tries to merge. Can anyone give me some insight into what the issue might be?
Error Message:
Exception: Invalid argument: replacement
The weird thing is that it doesn't prevent the information from merging, but the error does stop the function from completing the other tasks.
Line with the error
headers.forEach(function(e){
     body.replaceText("<<"+e+">>",data[e]);
    return;
  });

The whole code:
function documents(sheet, data){
     var headers = Object.keys(data[0]);     
     var docsToMerge = data.map(function(e){      
       var name = e.location +" - "+e.employeeLastName+", "+e.employeeFirstName+" - "+e.docName+" "+Utilities.formatDate(new Date(e.effectivePayDate), "UTC-4", "M/d/yy");
       var newDoc = DriveApp.getFileById(e.template).makeCopy(name, DriveApp.getFolderById(e.folderId));  
       e.documentLink = newDoc.getUrl();
       e.documentId = newDoc.getId();
       return e;
     });

      docsToMerge.forEach(function(e){
        mergeDocuments(e, headers, signatureFolderId);
      });
}

function mergeDocuments(data, headers){
  var id = DocumentApp.openByUrl(data.documentLink).getId();
  var doc = DocumentApp.openById(id);      
  var body = doc.getBody();

  headers.forEach(function(e){
     body.replaceText("<<"+e+">>",data[e]);
    return;
  });
  doc.saveAndClose();
  return;
}

A:

Desactive Runtime V8 in Run section of your script.

