Syntax error: Syntax error. line: 120 file: Code

Got error as the subject repeatedly while trying to save “Google Calendar Facility Booking Add-on” as Code.gs in the Google Apps Script, Gemini confirmed as below and I did follow but still got same error…

Gemini: I can confirm that the code in the Canvas is not missing any closing braces for any of the functions. Every function, loop, and try...catch block in the script has its opening { and closing } braces correctly matched. The code is syntactically complete.

Based on the screenshot you provided, the error message now points to the line facilities.forEach((facility, index) => {, which is also a perfectly valid line of code. This further confirms that the issue is not with a visible syntax error like a missing brace.

The most probable cause is a non-printable, hidden character or a persistent caching issue within the Apps Script editor itself. The editor is getting confused by something that we cannot see.

I strongly recommend you follow the steps I provided previously, using a plain text editor to strip out any hidden characters, as this is the most reliable way to resolve such an issue.

Line 120:

facilities.forEach((facility, index) => {       // Display both weekday and holiday prices in the dropdown item       checkboxGroup.addItem(         `${facility.Name} - Weekday: $${facility['Price (weekday)']} / Holiday: $${facility['Price (holiday)']}`,         JSON.stringify(facility), // Store the full facility object in the value         index === 0 // Pre-select the first item       );     });  

Syntax error is a misleading, Enable Chrome V8 runtime solved the issue,

But still got "Run time error. The script does not have permission to perform that action. Required permissions: https://www.googleapis.com/auth/calendar.addons.execute
after “Test deployments” installed in Application(s): Calendar

Checked the scopes in the Google Cloud, there is no “auth/calendar.addons.execute” but only “auth/calendar” should I apply for verification?

Thanks

Added “https://www.googleapis.com/auth/calendar.addons.execute” under oauthScopes in the appsscript.json, resolved the issue.