An error occurred in the attachment when executing the script : ["Syntax Error: Unexpected end of input","Syntax Error: Unexpected end of input"]

Error: [“Syntax Error: Unexpected end of input”,“Syntax Error: Unexpected end of input”]

DocumentBuilder version: 8.2.0
Installation method:
OS: Win 10

Question 1. An error occurred in the attachment when executing the script :
[“Syntax Error: Unexpected end of input”,“Syntax Error: Unexpected end of input”]
Question 2. Why does the size of the attachment change every other time, sometimes it decreases and increases.

Purpose: If the attachment has not changed (has not been reviewed), do not resave the attachment.

Since the signature (SignCMS) is invalid due to resaving

builder.OpenFile("test.docx");
var oDocument = Api.GetDocument();
var oReviewReport = oDocument.GetReviewReport();
if(Object.keys(oReviewReport).length){
   oDocument.AcceptAllRevisionChanges();
   builder.SaveFile("docx", "test.docx");
}
builder.CloseFile();

Hello @Erjigit

I’m not quite following complete scenario. Does opened document already contain revisions? Was it compared or something?

Also, the logic behind if block is unclear - there is not general condition for the query “If the attachment has not changed” and not rule for else, i.e. what to do if condition is not met.