Skip to content

Diagnostic coverage

What myFunction checks in Apps Script code.

Every Apps Script check myFunction adds on top of type checking, with the code each one flags, a corrected version, and the quick fix it offers.

Two layers

Type checking, then Apps Script rules.

myFunction type-checks each file against declarations generated from the Apps Script runtime. That layer catches the mistakes below in any service.

  • Unknown method or property

    SpreadsheetApp.getActiveSheet().getValue()

  • Missing or extra arguments

    GmailApp.createDraft("a@example.com")

  • Wrong argument type

    sheet.getRange("1", 1)

  • Name that is never declared

    fetch(url)

  • Syntax errors

    Logger.log("unterminated)

Implicit any and possibly-null results are reported as warnings because ordinary Apps Script code produces them often and still runs.

On top of that, myFunction adds the 156 Apps Script rules listed here. For 89 of them, the editor offers a quick fix or written guidance. The Chrome extension reports every rule. The gas_diagnostics MCP tool reports every rule except MF90006 and attaches the same quick fixes to its results, as edits an AI assistant can apply. The VS Code extension reports every rule except MF90006, MF92007, and the HTML page rules, because it does not yet read a project's HTML files or file order. The examples on this page come from the language server's tests, which check that each rule flags the first example and not the corrected one.

In the Chrome extension, the manifest and OAuth scope rules run when Show "appsscript.json" manifest file in editor is on in Project Settings, because the extension reads the manifest from the editor. In HTML files, the extension marks HTML page rule problems but does not offer their quick fixes yet. The MCP tool does return them.

Prefer reading these rules as practical habits instead of lint codes? Browse the Apps Script tips and tricks page.

Triggers and web apps

MF93001 Warning

Trigger or web app function name has the wrong case

Apps Script calls onOpen, onEdit, onSelectionChange, onInstall, doGet, and doPost by exact name. A function named onedit or DoGet never runs.

Quick fix: Rename the function to the exact trigger name.

Flagged 1 changed line
function onedit(e) {
  e.range.setNote("Edited");
}
Not flagged 1 changed line
function onEdit(e) {
  e.range.setNote("Edited");
}
MF93002 Warning

Simple trigger calls a service that needs authorization

onOpen, onEdit, and onSelectionChange run without authorization. Calls to GmailApp, MailApp, UrlFetchApp, DriveApp, CalendarApp, or ContactsApp, or opening another file by ID or URL, fail when the trigger fires.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
function onEdit(e) {
  MailApp.sendEmail("team@example.com", "Sheet edited", e.range.getA1Notation());
}
Not flagged 2 changed lines
// Run from an installable "On edit" trigger.
function notifyOnEdit(e) {
  MailApp.sendEmail("team@example.com", "Sheet edited", e.range.getA1Notation());
}
MF93003 Warning

doGet or doPost does not return a response

A web app must return an HtmlOutput or TextOutput. Without a return value, visitors see "The script completed but did not return anything."

Quick fix: Return the HtmlOutput or TextOutput the last line builds, evaluating a template first.

The script completed but did not return anything

Flagged 1 changed line
function doGet(e) {
  HtmlService.createHtmlOutput("<p>Hello</p>");
}
Not flagged 1 changed line
function doGet(e) {
  return HtmlService.createHtmlOutput("<p>Hello</p>");
}
MF93004 Error

Menu item, trigger, or add-on names a missing or private function

Menu.addItem(), ScriptApp.newTrigger(), CardService.Action.setFunctionName(), and addOns trigger fields in appsscript.json take the function name as text, and Apps Script only looks it up when the item is clicked or the trigger fires. A misspelled name, one written with parentheses, or a private function ending in _ for a CardService or add-on callback fails with "Script function not found". When the whole project is loaded, any missing function name is reported; otherwise only close matches, parentheses, and private add-on callbacks are flagged.

Quick fix: Change the name to the matching function, or drop the parentheses.

Script function not found

Flagged 1 changed line
function onOpen() {
  SpreadsheetApp.getUi().createMenu("Reports").addItem("Build", "buildReprot").addToUi();
}

function buildReport() {}
Not flagged 1 changed line
function onOpen() {
  SpreadsheetApp.getUi().createMenu("Reports").addItem("Build", "buildReport").addToUi();
}

function buildReport() {}
MF93005 Error

everyMinutes() with an unsupported interval

ClockTriggerBuilder.everyMinutes() accepts only 1, 5, 10, 15, or 30. Any other number makes the trigger setup fail.

Quick fix: Use the nearest supported interval.

Flagged 1 changed line
function installTrigger() {
  ScriptApp.newTrigger("syncRows").timeBased().everyMinutes(2).create();
}
Not flagged 1 changed line
function installTrigger() {
  ScriptApp.newTrigger("syncRows").timeBased().everyMinutes(5).create();
}
MF93006 Error

doGet or doPost returns a template that was not evaluated

createTemplateFromFile() returns an HtmlTemplate. A web app needs the HtmlOutput that evaluate() produces, so returning the template itself fails.

Quick fix: Append .evaluate().

The script completed but did not return anything

Flagged 1 changed line
function doGet(e) {
  return HtmlService.createTemplateFromFile("Index");
}
Not flagged 1 changed line
function doGet(e) {
  return HtmlService.createTemplateFromFile("Index").evaluate();
}
MF93007 Suggestion

JSON text output without a JSON MIME type

ContentService.createTextOutput() serves plain text unless setMimeType() says otherwise, so a JSON response arrives as text/plain.

Quick fix: Append .setMimeType(ContentService.MimeType.JSON).

Flagged 1 changed line
function doGet(e) {
  return ContentService.createTextOutput(JSON.stringify({ ok: true }));
}
Not flagged 1 changed line
function doGet(e) {
  return ContentService.createTextOutput(JSON.stringify({ ok: true })).setMimeType(ContentService.MimeType.JSON);
}
MF93008 Warning

Installable trigger on a simple trigger name

A function named onOpen, onEdit, onSelectionChange, or onInstall already runs as a simple trigger. An installable trigger that points at it makes the function run from both triggers, for example twice on every edit.

Quick fix: None. The message explains the change to make.

Flagged 2 changed lines
function installEditTrigger() {
  ScriptApp.newTrigger("onEdit").forSpreadsheet(SpreadsheetApp.getActive()).onEdit().create();
}

function onEdit(e) {
  e.range.setNote("Edited");
}
Not flagged 2 changed lines
function installEditTrigger() {
  ScriptApp.newTrigger("onEditInstalled").forSpreadsheet(SpreadsheetApp.getActive()).onEdit().create();
}

function onEditInstalled(e) {
  e.range.setNote("Edited");
}
MF93009 Suggestion

onInstall() does not call onOpen()

When a user installs an editor add-on, only onInstall() runs, so the add-on menu stays missing until the file is reopened. Google's add-on samples call onOpen(e) from onInstall(e).

Quick fix: Add onOpen(e) as the first line of onInstall().

Flagged 1 changed line
function onOpen(e) {
  SpreadsheetApp.getUi().createAddonMenu().addItem("Run report", "runReport").addToUi();
}

function onInstall(e) {
  Logger.log("Installed");
}

function runReport() {}
Not flagged 1 changed line
function onOpen(e) {
  SpreadsheetApp.getUi().createAddonMenu().addItem("Run report", "runReport").addToUi();
}

function onInstall(e) {
  onOpen(e);
}

function runReport() {}
MF93010 Warning

Editor UI from a web app or background trigger

getUi() and Browser dialogs need an open Sheets, Docs, Slides, or Forms editor. When doGet, doPost, a time-driven trigger, or a form-submit trigger reaches them, directly or through other functions, the call throws. Calls inside a try block are skipped.

Quick fix: None. The message explains the change to make.

Cannot call SpreadsheetApp.getUi() from this context

Flagged 1 changed line
function doGet() {
  notify("Report ready");
  return HtmlService.createHtmlOutput("Done");
}

function notify(message) {
  SpreadsheetApp.getUi().alert(message);
}
Not flagged 1 changed line
function doGet() {
  notify("Report ready");
  return HtmlService.createHtmlOutput("Done");
}

function notify(message) {
  console.log(message);
}
MF93011 Warning

Visitor email in a web app that runs as you

A web app deployed to execute as you returns an empty string from Session.getActiveUser().getEmail() unless the visitor is in your Google Workspace domain. Deploy it to execute as the user accessing it when you need the visitor's email.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
// appsscript.json: "webapp": { "executeAs": "USER_DEPLOYING" }
function doGet() {
  const email = Session.getActiveUser().getEmail();
  return HtmlService.createHtmlOutput("Hello " + email);
}
Not flagged 1 changed line
// appsscript.json: "webapp": { "executeAs": "USER_ACCESSING" }
function doGet() {
  const email = Session.getActiveUser().getEmail();
  return HtmlService.createHtmlOutput("Hello " + email);
}
MF93012 Warning

Trigger created on every run

Simple triggers such as onOpen run without authorization, so creating a trigger from one fails. From doGet or doPost, each request adds another trigger until the project hits its limit of 20 per user. Create triggers from a menu item or a function you run once, or check getProjectTriggers() first.

Quick fix: None. The message explains the change to make.

This script has too many triggers

Flagged 0 changed lines
function onOpen() {
  ScriptApp.newTrigger("sync").timeBased().everyHours(1).create();
}

function sync() {}
Not flagged 4 changed lines
function onOpen() {
  SpreadsheetApp.getUi().createMenu("Sync").addItem("Turn on hourly sync", "installSync").addToUi();
}

function installSync() {
  ScriptApp.newTrigger("sync").timeBased().everyHours(1).create();
}

function sync() {}
MF93013 Warning

Event property called as a function

The event object Apps Script passes to onEdit, onOpen, doGet, and the other entry points holds plain values such as e.range, e.value, and e.parameter. Calling one, as in e.range(), throws "TypeError: e.range is not a function" when the trigger fires or the web app loads.

Quick fix: Remove the parentheses so the code reads the property.

TypeError: e.range is not a function

Flagged 1 changed line
function onEdit(e) {
  e.range().setNote("Edited");
}
Not flagged 1 changed line
function onEdit(e) {
  e.range.setNote("Edited");
}
MF93014 Error

async on a return-value entry point

doGet(), doPost(), server functions called by google.script.run, and CardService add-on callbacks return values directly to Apps Script. Marking one async makes it return a Promise, which Apps Script does not await. Regular async functions and void triggers are allowed and are not flagged.

Quick fix: Remove async (and await on synchronous Apps Script calls).

Flagged 2 changed lines
async function doGet(e) {
  const response = await UrlFetchApp.fetch("https://api.example.com/status");
  return ContentService.createTextOutput(response.getContentText());
}
Not flagged 2 changed lines
function doGet(e) {
  const response = UrlFetchApp.fetch("https://api.example.com/status");
  return ContentService.createTextOutput(response.getContentText());
}
MF93015 Warning

Unhandled Promise rejection

Apps Script has no unhandledRejection error reporting, so a rejected Promise in an async entry point without try/catch or a detached .then() chain without .catch() fails silently.

Quick fix: None. The message explains the change to make.

Flagged 2 changed lines
async function runSync() {
  const result = await fetchRemoteData();
  Logger.log(result);
}

async function fetchRemoteData() {
  return Promise.resolve("ok");
}
Not flagged 6 changed lines
async function runSync() {
  try {
    const result = await fetchRemoteData();
    Logger.log(result);
  } catch (error) {
    console.error(error);
  }
}

async function fetchRemoteData() {
  return Promise.resolve("ok");
}
MF93016 Warning

e.postData read inside doGet()

HTTP GET requests have no request body, so e.postData is never present in doGet(e). Read query parameters from e.parameter or e.parameters, or handle POST bodies in doPost(e).

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
function doGet(e) {
  const payload = JSON.parse(e.postData.contents);
  return ContentService.createTextOutput(payload.id);
}
Not flagged 1 changed line
function doPost(e) {
  const payload = JSON.parse(e.postData.contents);
  return ContentService.createTextOutput(payload.id);
}
MF93017 Warning

onEdit() reads e.value or e.oldValue without a guard

In onEdit(e), e.value and e.oldValue are undefined when a user pastes or clears multiple cells, and e.value is undefined when a single cell is cleared. Check for undefined or single-cell range dimensions before using them, or read e.range.getValues().

Quick fix: None. The message explains the change to make.

Flagged 0 changed lines
function onEdit(e) {
  e.range.setNote("New value: " + e.value.trim());
}
Not flagged 1 changed line
function onEdit(e) {
  if (e.value === undefined) return;
  e.range.setNote("New value: " + e.value.trim());
}
MF93018 Error

ClockTriggerBuilder argument out of range

ClockTriggerBuilder rejects out-of-range arguments at runtime: everyHours() accepts only 1, 2, 4, 6, 8, or 12; atHour() accepts 0 to 23; nearMinute() accepts 0 to 59; onMonthDay() accepts 1 to 31; atDate(year, month, day) uses a 1-based month from 1 to 12; and everyDays(), everyWeeks(), and after() require at least 1.

Quick fix: Replace the argument with a supported value when unambiguous.

Flagged 1 changed line
function installTrigger() {
  ScriptApp.newTrigger("syncRows").timeBased().everyHours(3).create();
}

function syncRows() {}
Not flagged 1 changed line
function installTrigger() {
  ScriptApp.newTrigger("syncRows").timeBased().everyHours(4).create();
}

function syncRows() {}
MF93019 Warning

ScriptApp.newTrigger() builder never calls create()

ScriptApp.newTrigger() returns a trigger builder that does nothing until .create() is called. A discarded trigger builder statement leaves no trigger installed.

Quick fix: Append .create().

Flagged 1 changed line
function installTrigger() {
  ScriptApp.newTrigger("syncRows").timeBased().everyHours(1);
}

function syncRows() {}
Not flagged 1 changed line
function installTrigger() {
  ScriptApp.newTrigger("syncRows").timeBased().everyHours(1).create();
}

function syncRows() {}
MF93020 Warning

Editor add-on onOpen() calls an API restricted in AuthMode.NONE

In an Editor Add-on, onOpen(e) runs in ScriptApp.AuthMode.NONE before the add-on is enabled for the current document. Calling PropertiesService, CacheService, LockService, Session, or active document methods without checking e.authMode throws an authorization error.

Quick fix: None. The message explains the change to make.

Flagged 5 changed lines
function onOpen(e) {
  const enabled = PropertiesService.getDocumentProperties().getProperty("enabled");
  SpreadsheetApp.getUi()
    .createAddonMenu()
    .addItem(enabled ? "Refresh" : "Setup", "runAddon")
    .addToUi();
}

function runAddon() {}
Not flagged 8 changed lines
function onOpen(e) {
  const menu = SpreadsheetApp.getUi().createAddonMenu();
  if (e && e.authMode === ScriptApp.AuthMode.NONE) {
    menu.addItem("Setup", "runAddon");
  } else {
    const enabled = PropertiesService.getDocumentProperties().getProperty("enabled");
    menu.addItem(enabled ? "Refresh" : "Setup", "runAddon");
  }
  menu.addToUi();
}

function runAddon() {}
MF93021 Error

CardService builder returned without build()

CardService builder classes such as CardBuilder and ActionResponseBuilder must be finalized with .build() before returning them from a Google Workspace Add-on callback.

Quick fix: Append .build().

Flagged 3 changed lines
function onHomepage() {
  return CardService.newCardBuilder().setHeader(
    CardService.newCardHeader().setTitle("Overview"),
  );
}
Not flagged 3 changed lines
function onHomepage() {
  return CardService.newCardBuilder()
    .setHeader(CardService.newCardHeader().setTitle("Overview"))
    .build();
}
MF93022 Error

Web app reads unavailable HTTP request property

Apps Script web apps never expose HTTP headers, method, cookies, or e.body on the doGet(e)/doPost(e) event object. e.headers is always undefined, and POST bodies live on e.postData.contents.

Quick fix: Replace e.body with e.postData.contents in doPost().

Flagged 1 changed line
function doPost(e) {
  const payload = JSON.parse(e.body);
  return ContentService.createTextOutput(payload.id);
}
Not flagged 1 changed line
function doPost(e) {
  const payload = JSON.parse(e.postData.contents);
  return ContentService.createTextOutput(payload.id);
}
MF93023 Error

onFormSubmit() mixes Sheets and Forms event properties

Sheets onFormSubmit triggers pass e.values, e.namedValues, and e.range, while Forms onFormSubmit triggers pass e.response. Reading the wrong trigger's properties throws a TypeError when a form is submitted.

Quick fix: None. The message explains the change to make.

Flagged 2 changed lines
function onFormSubmit(e) {
  const email = e.namedValues["Email"][0];
  const responses = e.response.getItemResponses();
  Logger.log("%s %s", email, responses.length);
}
Not flagged 1 changed line
function onFormSubmit(e) {
  const email = e.namedValues["Email"][0];
  Logger.log("%s", email);
}
MF93024 Warning

Active sheet or selection read in a background trigger or web app

In onFormSubmit(), getActiveSheet() always returns the first tab rather than the form destination sheet (use e.range.getSheet()). In background triggers and web apps, getActiveRange(), getActiveCell(), and getSelection() have no open editor selection and return A1 or null.

Quick fix: Use e.range.getSheet() inside onFormSubmit().

Flagged 1 changed line
function onFormSubmit(e) {
  const sheet = SpreadsheetApp.getActiveSheet();
  sheet.getRange(e.range.getRow(), 5).setValue("Received");
}
Not flagged 1 changed line
function onFormSubmit(e) {
  const sheet = e.range.getSheet();
  sheet.getRange(e.range.getRow(), 5).setValue("Received");
}
MF93025 Error

CardService button, action, or OpenLink missing required configuration

CardService TextButton and ImageButton require either a click action or setOpenLink() (never both), newOpenLink() requires setUrl(), and newAction() requires setFunctionName(). Omitting or conflicting them fails when the add-on renders the card.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
function buildCard() {
  const button = CardService.newTextButton().setText("Open");
  const section = CardService.newCardSection().addWidget(button);
  return CardService.newCardBuilder().addSection(section).build();
}
Not flagged 4 changed lines
function buildCard() {
  const action = CardService.newAction().setFunctionName("handleClick");
  const button = CardService.newTextButton().setText("Open").setOnClickAction(action);
  const section = CardService.newCardSection().addWidget(button);
  return CardService.newCardBuilder().addSection(section).build();
}

function handleClick() {}

Ranges

MF94001 Error

getRange() with a zero or negative coordinate

Rows and columns start at 1, and a range needs at least one row and one column. Sheet.getRange(0, 1) or a literal 0 for numRows throws "The coordinates or dimensions of the range are invalid."

Quick fix: Change a 0 row or column to 1.

The coordinates or dimensions of the range are invalid

Flagged 1 changed line
function readHeader() {
  const sheet = SpreadsheetApp.getActiveSheet();
  return sheet.getRange(0, 1, 1, 5).getValues();
}
Not flagged 1 changed line
function readHeader() {
  const sheet = SpreadsheetApp.getActiveSheet();
  return sheet.getRange(1, 1, 1, 5).getValues();
}
MF94002 Error

setValues() data does not match the range size

setValues() and the other 2D setters need exactly one row of data per range row and one value per column. When getRange() has literal dimensions or A1 notation and the data is an array literal, a different row count throws "The number of rows in the data does not match the number of rows in the range." A different column count, or rows of uneven length, throws the same error for columns.

Quick fix: Size getRange() to the rows and columns of the data.

The number of columns in the data does not match the number of columns in the range

Flagged 1 changed line
function writeHeader() {
  const sheet = SpreadsheetApp.getActiveSheet();
  sheet.getRange(1, 1, 1, 3).setValues([["Name", "Email"]]);
}
Not flagged 1 changed line
function writeHeader() {
  const sheet = SpreadsheetApp.getActiveSheet();
  sheet.getRange(1, 1, 1, 2).setValues([["Name", "Email"]]);
}
MF94003 Warning

Row count from getLastRow() can be 0

getRange(2, 1, sheet.getLastRow() - 1, n) asks for zero rows on a sheet that holds only a header, and getRange() throws "The number of rows in the range must be at least 1." The rule stays quiet when the function compares the last row before reading. getLastColumn() counts are checked the same way.

Quick fix: Return early when the sheet has nothing past the header, in functions that return no value.

Flagged 0 changed lines
function readRows() {
  const sheet = SpreadsheetApp.getActiveSheet();
  const rows = sheet.getRange(2, 1, sheet.getLastRow() - 1, 3).getValues();
  Logger.log(rows.length);
}
Not flagged 1 changed line
function readRows() {
  const sheet = SpreadsheetApp.getActiveSheet();
  if (sheet.getLastRow() <= 1) return;
  const rows = sheet.getRange(2, 1, sheet.getLastRow() - 1, 3).getValues();
  Logger.log(rows.length);
}
MF94004 Warning

getLastRow() passed as a row count

The third argument of getRange() is a number of rows, not the last row. Starting at row 2 with getLastRow() rows reads one row past the data, and the extra rows come back as empty strings.

Quick fix: Subtract the rows above the start row.

Flagged 1 changed line
function readRows() {
  const sheet = SpreadsheetApp.getActiveSheet();
  return sheet.getRange(2, 1, sheet.getLastRow(), 3).getValues();
}
Not flagged 1 changed line
function readRows() {
  const sheet = SpreadsheetApp.getActiveSheet();
  return sheet.getRange(2, 1, sheet.getLastRow() - 1, 3).getValues();
}
MF94005 Warning

Rows deleted in a loop that counts up

deleteRow() moves every later row up by one. In a loop that counts up, the row after each deleted one is never visited. The rule stays quiet when the loop corrects the index, for example with i--.

Quick fix: Reverse the loop so it counts down.

Flagged 1 changed line
function removeDone() {
  const sheet = SpreadsheetApp.getActiveSheet();
  const values = sheet.getDataRange().getValues();
  for (let i = 1; i < values.length; i++) {
    if (values[i][0] === "Done") sheet.deleteRow(i + 1);
  }
}
Not flagged 1 changed line
function removeDone() {
  const sheet = SpreadsheetApp.getActiveSheet();
  const values = sheet.getDataRange().getValues();
  for (let i = values.length - 1; i >= 1; i--) {
    if (values[i][0] === "Done") sheet.deleteRow(i + 1);
  }
}
MF94006 Warning

Array passed to Range.setValue()

Range.setValue() writes a single cell and coerces an array into a string instead of filling multiple cells. TypeScript does not reject this because setValue() accepts unknown. Use setValues() with a 2D array to write a grid.

Quick fix: Switch to setValues(), wrapping a 1D array literal as a single row.

Flagged 1 changed line
function writeHeader() {
  const sheet = SpreadsheetApp.getActiveSheet();
  sheet.getRange("A1:B1").setValue(["Name", "Email"]);
}
Not flagged 1 changed line
function writeHeader() {
  const sheet = SpreadsheetApp.getActiveSheet();
  sheet.getRange("A1:B1").setValues([["Name", "Email"]]);
}
MF94007 Error

Malformed A1 notation in getRange() or getRangeList()

getRange() and getRangeList() throw at runtime when an A1 notation string has row 0, a bad range separator such as ';', an empty cell reference, or an unquoted sheet name containing spaces or special characters.

Quick fix: Wrap an unquoted sheet name in single quotes.

Flagged 1 changed line
function readTotal() {
  const ss = SpreadsheetApp.getActiveSpreadsheet();
  return ss.getRange("My Sheet!A1:B5").getValues();
}
Not flagged 1 changed line
function readTotal() {
  const ss = SpreadsheetApp.getActiveSpreadsheet();
  return ss.getRange("'My Sheet'!A1:B5").getValues();
}
MF94008 Suggestion

Spreadsheet.getRange() without a sheet name

Calling getRange() directly on a Spreadsheet without a SheetName! prefix silently targets whichever sheet happens to be active. Prefix the sheet name or call getRange() on a specific Sheet.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
function readSummary() {
  const ss = SpreadsheetApp.getActiveSpreadsheet();
  return ss.getRange("A1:B5").getValues();
}
Not flagged 1 changed line
function readSummary() {
  const ss = SpreadsheetApp.getActiveSpreadsheet();
  return ss.getRange("Summary!A1:B5").getValues();
}
MF94009 Warning

Non-US formula syntax in setFormula() or setFormulas()

setFormula() and setFormulas() always expect US-locale formula syntax regardless of the spreadsheet locale, using commas between arguments and English function names. Semicolons inside array literals and quoted strings are allowed.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
function setTotalFormula() {
  const sheet = SpreadsheetApp.getActiveSheet();
  sheet.getRange("C1").setFormula("=SUMME(A1; B1)");
}
Not flagged 1 changed line
function setTotalFormula() {
  const sheet = SpreadsheetApp.getActiveSheet();
  sheet.getRange("C1").setFormula("=SUM(A1, B1)");
}
MF94010 Suggestion

Formula string or untrusted input passed to setValue()

setValue() and setValues() parse strings starting with '=' as formulas. Use setFormula() or setFormulas() for intentional formulas, or prefix literal text with a single quote. Writing web or form input (e.parameter or e.values) directly to setValue(), setValues(), or appendRow() escalates to a warning for formula injection.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
function writeTotal() {
  const sheet = SpreadsheetApp.getActiveSheet();
  sheet.getRange("C1").setValue("=SUM(A1:B1)");
}
Not flagged 1 changed line
function writeTotal() {
  const sheet = SpreadsheetApp.getActiveSheet();
  sheet.getRange("C1").setFormula("=SUM(A1:B1)");
}
MF94011 Warning

getMaxRows() or getMaxColumns() used to read values

getMaxRows() and getMaxColumns() include every empty trailing row or column allocated on the sheet, making getValues() and other reads slow and memory-heavy. Structural calls such as deleteRows() or clearFormat() are not flagged.

Quick fix: Replace getMaxRows() with getLastRow(), or getMaxColumns() with getLastColumn().

Flagged 1 changed line
function readAllRows() {
  const sheet = SpreadsheetApp.getActiveSheet();
  return sheet.getRange(1, 1, sheet.getMaxRows(), 3).getValues();
}
Not flagged 1 changed line
function readAllRows() {
  const sheet = SpreadsheetApp.getActiveSheet();
  return sheet.getRange(1, 1, sheet.getLastRow(), 3).getValues();
}
MF94012 Error

Range.copyTo() across different spreadsheets

Range.copyTo() only copies within the same spreadsheet and throws at runtime when source and destination belong to different spreadsheets. Read values with getValues() and write them to the destination range with setValues().

Quick fix: None. The message explains the change to make.

Target range and source range must be on the same spreadsheet

Flagged 3 changed lines
function copySummary() {
  const src = SpreadsheetApp.getActiveSheet().getRange("A1:B5");
  const dst = SpreadsheetApp.openById("TARGET_ID").getSheets()[0].getRange("A1:B5");
  src.copyTo(dst);
}
Not flagged 2 changed lines
function copySummary() {
  const values = SpreadsheetApp.getActiveSheet().getRange("A1:B5").getValues();
  SpreadsheetApp.openById("TARGET_ID").getSheets()[0].getRange("A1:B5").setValues(values);
}
MF92004 Warning

for...in over an array

for...in yields each array index as a string, so with rows from getValues(), i + 2 is "02" and a getRange() row computed from it is wrong. It can also visit properties that are not elements. Use a counting for loop, for...of, or forEach().

Quick fix: Rewrite as a counting for loop over the array's length.

Flagged 1 changed line
function logRows() {
  const rows = SpreadsheetApp.getActiveSheet().getDataRange().getValues();
  for (var i in rows) {
    Logger.log("Row " + (i + 1) + ": " + rows[i][0]);
  }
}
Not flagged 1 changed line
function logRows() {
  const rows = SpreadsheetApp.getActiveSheet().getDataRange().getValues();
  for (var i = 0; i < rows.length; i++) {
    Logger.log("Row " + (i + 1) + ": " + rows[i][0]);
  }
}
MF94013 Error

One-based Sheets row, column, or count argument is 0 or negative

Google Sheets row, column, and dimension counts start at 1 across getCell(), deleteRow(), insertRowBefore(), hideRows(), setColumnWidth(), sort(), and Range.offset() numRows/numColumns. Passing 0 or a negative literal throws at runtime.

Quick fix: Change a literal 0 row, column, or count argument to 1.

Flagged 1 changed line
function removeFirstRow() {
  const sheet = SpreadsheetApp.getActiveSheet();
  sheet.deleteRow(0);
}
Not flagged 1 changed line
function removeFirstRow() {
  const sheet = SpreadsheetApp.getActiveSheet();
  sheet.deleteRow(1);
}
MF94014 Error

deleteRows() or deleteColumns() deletes every row or column in a sheet

Google Sheets requires every sheet to keep at least one non-frozen row and column, so sheet.deleteRows(1, sheet.getMaxRows()) or sheet.deleteColumns(1, sheet.getMaxColumns()) throws at runtime. Keep at least one row or column, or call clearContents().

Quick fix: None. The message explains the change to make.

Exception: Cannot delete all non-frozen rows

Flagged 1 changed line
function clearAll(sheet) {
  sheet.deleteRows(1, sheet.getMaxRows());
}
Not flagged 1 changed line
function clearAll(sheet) {
  sheet.clearContents();
}
MF94015 Warning

insertSheet() called with a literal name without checking getSheetByName()

Spreadsheet.insertSheet('Log') throws 'A sheet with the name "Log" already exists' on the second run. Check getSheetByName() first or reuse the existing tab.

Quick fix: Reuse the existing sheet with getSheetByName() before calling insertSheet().

A sheet with the name '...' already exists

Flagged 1 changed line
function getLogSheet() {
  const ss = SpreadsheetApp.getActiveSpreadsheet();
  return ss.insertSheet("Log");
}
Not flagged 1 changed line
function getLogSheet() {
  const ss = SpreadsheetApp.getActiveSpreadsheet();
  return ss.getSheetByName("Log") || ss.insertSheet("Log");
}

Services and limits

MF95001 Warning

JSON request sent as form fields

When payload is an object, UrlFetchApp encodes it as form fields (a=1&b=2), whatever contentType says. An API expecting JSON then rejects the request.

Quick fix: Wrap the payload in JSON.stringify().

Flagged 1 changed line
function createItem() {
  UrlFetchApp.fetch("https://example.com/items", {
    method: "post",
    contentType: "application/json",
    payload: { name: "New item" },
  });
}
Not flagged 1 changed line
function createItem() {
  UrlFetchApp.fetch("https://example.com/items", {
    method: "post",
    contentType: "application/json",
    payload: JSON.stringify({ name: "New item" }),
  });
}
MF95002 Warning

formatDate() pattern uses the wrong letters

Utilities.formatDate() patterns follow Java SimpleDateFormat. YYYY is the week year, which is off by one for some dates around January 1. DD is the day of the year, and mm is minutes, so dd/mm/yyyy prints the minutes where the month should be.

Quick fix: Use yyyy, dd, and MM.

Flagged 1 changed line
function stamp() {
  return Utilities.formatDate(new Date(), Session.getScriptTimeZone(), "dd/mm/YYYY");
}
Not flagged 1 changed line
function stamp() {
  return Utilities.formatDate(new Date(), Session.getScriptTimeZone(), "dd/MM/yyyy");
}
MF95003 Error

Utilities.sleep() longer than 5 minutes

Utilities.sleep() accepts at most 300000 milliseconds. A longer wait needs a time-driven trigger.

Quick fix: Use 300000.

Flagged 1 changed line
function waitAndRetry() {
  Utilities.sleep(600000);
}
Not flagged 1 changed line
function waitAndRetry() {
  Utilities.sleep(300000);
}
MF95004 Error

Cache expiration outside 1 to 21600 seconds

Cache entries last at most 6 hours. put() and putAll() reject an expiration above 21600 seconds or below 1.

Quick fix: Use the nearest allowed expiration.

Flagged 1 changed line
function remember(value) {
  CacheService.getScriptCache().put("latest", value, 86400);
}
Not flagged 1 changed line
function remember(value) {
  CacheService.getScriptCache().put("latest", value, 21600);
}
MF95005 Warning

Drive iterator next() without hasNext()

DriveApp.getFilesByName() and similar calls return an iterator. Calling next() when nothing matches throws, so a renamed or missing file stops the script with an error that does not name the file.

Quick fix: Store the iterator and throw a clear error when hasNext() is false.

Cannot retrieve the next object: iterator has reached the end

Flagged 1 changed line
function reportName() {
  return DriveApp.getFilesByName("Report").next().getName();
}
Not flagged 3 changed lines
function reportName() {
  const files = DriveApp.getFilesByName("Report");
  if (!files.hasNext()) throw new Error("No file named Report.");
  return files.next().getName();
}
MF95006 Warning

muteHttpExceptions without a status check

With muteHttpExceptions: true, UrlFetchApp returns 4xx and 5xx responses instead of throwing. Code that reads the body without calling getResponseCode() treats an error page as data.

Quick fix: Throw when the status is 400 or above, with the response body in the message.

Flagged 0 changed lines
function fetchItems(url) {
  const response = UrlFetchApp.fetch(url, { muteHttpExceptions: true });
  return JSON.parse(response.getContentText());
}
Not flagged 3 changed lines
function fetchItems(url) {
  const response = UrlFetchApp.fetch(url, { muteHttpExceptions: true });
  if (response.getResponseCode() >= 400) {
    throw new Error("Request failed with status " + response.getResponseCode() + ": " + response.getContentText());
  }
  return JSON.parse(response.getContentText());
}
MF95007 Warning

tryLock() result ignored

tryLock() returns false when another run holds the lock past the timeout. If the result is not checked, the code after it runs without the lock it was meant to have.

Quick fix: Use waitLock(), which throws when the lock is not available in time.

Flagged 1 changed line
function addRow(values) {
  const lock = LockService.getScriptLock();
  lock.tryLock(10000);
  try {
    SpreadsheetApp.getActiveSheet().appendRow(values);
  } finally {
    lock.releaseLock();
  }
}
Not flagged 1 changed line
function addRow(values) {
  const lock = LockService.getScriptLock();
  lock.waitLock(10000);
  try {
    SpreadsheetApp.getActiveSheet().appendRow(values);
  } finally {
    lock.releaseLock();
  }
}
MF95008 Suggestion

Lock never released

A lock from waitLock() or tryLock() is held until the script finishes when the function never calls releaseLock(). Other runs wait for that whole time. Release it in a finally block so an error does not keep it held either.

Quick fix: None. The message explains the change to make.

Lock timeout: another process was holding the lock for too long

Flagged 1 changed line
function addRow(values) {
  const lock = LockService.getScriptLock();
  lock.waitLock(10000);
  SpreadsheetApp.getActiveSheet().appendRow(values);
  sendSummary();
}

function sendSummary() {}
Not flagged 5 changed lines
function addRow(values) {
  const lock = LockService.getScriptLock();
  lock.waitLock(10000);
  try {
    SpreadsheetApp.getActiveSheet().appendRow(values);
  } finally {
    lock.releaseLock();
  }
  sendSummary();
}

function sendSummary() {}
MF95009 Warning

Key or token in the code

A string that looks like an API key, access token, or bearer token is readable by anyone who can view or copy the project, and it stays in the version history after you delete it. Keep it in Script Properties and read it with PropertiesService. The message never repeats the value.

Quick fix: Read the value from Script Properties; add the property under Project Settings and rotate the old key.

Flagged 1 changed line
function getOrders() {
  const response = UrlFetchApp.fetch("https://api.example.com/orders", {
    headers: { Authorization: "Bearer 3f9a7c2e1b8d4f6a0c5e9b7d2a4f8c1e" },
  });
  return JSON.parse(response.getContentText());
}
Not flagged 1 changed line
function getOrders() {
  const response = UrlFetchApp.fetch("https://api.example.com/orders", {
    headers: { Authorization: "Bearer " + PropertiesService.getScriptProperties().getProperty("API_TOKEN") },
  });
  return JSON.parse(response.getContentText());
}
MF95010 Suggestion

Query value not URL-encoded

A value placed after ?name= or &name= in a fetched URL goes in as typed. A space, &, #, or accented letter in it breaks the request or changes which parameters the server sees. Wrap the value in encodeURIComponent().

Quick fix: Wrap the value in encodeURIComponent().

Flagged 1 changed line
function search(term) {
  return UrlFetchApp.fetch("https://api.example.com/search?q=" + term);
}
Not flagged 1 changed line
function search(term) {
  return UrlFetchApp.fetch("https://api.example.com/search?q=" + encodeURIComponent(term));
}
MF95011 Suggestion

formatDate() time zone differs from the project

A time zone written into Utilities.formatDate() stays fixed when the project's time zone in appsscript.json changes, and it disagrees with it now. Session.getScriptTimeZone() follows the manifest. UTC and GMT offsets are not flagged.

Quick fix: Use Session.getScriptTimeZone().

Flagged 1 changed line
// appsscript.json: "timeZone": "Europe/London"
function label(date) {
  return Utilities.formatDate(date, "America/New_York", "yyyy-MM-dd");
}
Not flagged 1 changed line
// appsscript.json: "timeZone": "Europe/London"
function label(date) {
  return Utilities.formatDate(date, Session.getScriptTimeZone(), "yyyy-MM-dd");
}
MF95012 Warning

PropertiesService or CacheService size limit exceeded

PropertiesService caps each value at 9 KB (and 500 KB total), and CacheService caps keys at 250 characters and values at 100 KB. Literal values over those limits, or passing JSON.stringify(sheet.getDataRange().getValues()) directly to setProperty(), throw at runtime.

Quick fix: None. The message explains the change to make.

Exception: Argument too large: value

Flagged 1 changed line
function backupSheet() {
  const sheet = SpreadsheetApp.getActiveSheet();
  PropertiesService.getScriptProperties().setProperty("rows", JSON.stringify(sheet.getDataRange().getValues()));
}
Not flagged 1 changed line
function backupSheet() {
  const sheet = SpreadsheetApp.getActiveSheet();
  DriveApp.createFile("rows.json", JSON.stringify(sheet.getDataRange().getValues()), "application/json");
}
MF95013 Warning

Unguarded getDocumentProperties() in a web app

PropertiesService.getDocumentProperties() returns null in standalone scripts. Calling methods on it inside doGet() or doPost() without a null check throws a TypeError unless the script is bound to a document.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
function doGet() {
  const props = PropertiesService.getDocumentProperties();
  return ContentService.createTextOutput(props.getProperty("mode") ?? "");
}
Not flagged 1 changed line
function doGet() {
  const props = PropertiesService.getScriptProperties();
  return ContentService.createTextOutput(props.getProperty("mode") ?? "");
}
MF95014 Warning

Unknown Fetch API option on UrlFetchApp

UrlFetchApp ignores Fetch API option names such as body, redirect, mode, credentials, and capitalized ContentType. Requests silently drop the body or send the wrong content type.

Quick fix: Rename body to payload or ContentType to contentType.

Flagged 2 changed lines
function postItem(url, data) {
  const options = {
    method: "post",
    ContentType: "application/json",
    body: JSON.stringify(data),
  };
  return UrlFetchApp.fetch(url, options);
}
Not flagged 2 changed lines
function postItem(url, data) {
  const options = {
    method: "post",
    contentType: "application/json",
    payload: JSON.stringify(data),
  };
  return UrlFetchApp.fetch(url, options);
}
MF95015 Warning

Explicit GET request with a payload

UrlFetchApp rejects or drops request bodies when method is explicitly set to get. When method is omitted alongside payload, UrlFetchApp sends a POST automatically, so only explicit GET with payload is flagged.

Quick fix: None. The message explains the change to make.

Flagged 2 changed lines
function search(url, term) {
  return UrlFetchApp.fetch(url, {
    method: "get",
    payload: { q: term },
  });
}
Not flagged 1 changed line
function search(url, term) {
  return UrlFetchApp.fetch(url + "?q=" + encodeURIComponent(term), {
    method: "get",
  });
}
MF95016 Warning

TLS certificate verification disabled

Setting validateHttpsCertificates: false in UrlFetchApp disables HTTPS certificate checks and exposes the request and any credentials in it to interception.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
function loadFeed(url) {
  return UrlFetchApp.fetch(url, { validateHttpsCertificates: false }).getContentText();
}
Not flagged 1 changed line
function loadFeed(url) {
  return UrlFetchApp.fetch(url).getContentText();
}
MF95017 Error

Google OAuth token sent to a non-Google host

ScriptApp.getOAuthToken() returns a bearer token authorized for your Google account and script scopes. Sending it via UrlFetchApp to a non-Google host leaks that access token to a third party.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
function syncData() {
  return UrlFetchApp.fetch("https://api.example.com/sync", {
    headers: { Authorization: "Bearer " + ScriptApp.getOAuthToken() },
  });
}
Not flagged 2 changed lines
function syncData() {
  const key = PropertiesService.getScriptProperties().getProperty("EXAMPLE_API_KEY");
  return UrlFetchApp.fetch("https://api.example.com/sync", {
    headers: { Authorization: "Bearer " + key },
  });
}
MF95018 Suggestion

JDBC connection, statement, or result set never closed

Jdbc.getConnection(), prepareStatement(), and executeQuery() hold database connections and cursors open until closed. Leaving them unclosed can exhaust connection pool limits.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
function countUsers(url) {
  const conn = Jdbc.getConnection(url);
  const stmt = conn.prepareStatement("SELECT COUNT(*) FROM users");
  const rs = stmt.executeQuery();
  return rs.next() ? rs.getInt(1) : 0;
}
Not flagged 7 changed lines
function countUsers(url) {
  const conn = Jdbc.getConnection(url);
  const stmt = conn.prepareStatement("SELECT COUNT(*) FROM users");
  const rs = stmt.executeQuery();
  try {
    return rs.next() ? rs.getInt(1) : 0;
  } finally {
    rs.close();
    stmt.close();
    conn.close();
  }
}
MF95019 Warning

SQL query built with string concatenation

Concatenating or interpolating dynamic values into executeQuery(), executeUpdate(), or execute() exposes the database to SQL injection. Use prepareStatement() with ? placeholders and bind values with setString() or setInt().

Quick fix: None. The message explains the change to make.

Flagged 2 changed lines
/** @param {Jdbc.JdbcConnection} conn */
function findUser(conn, email) {
  const stmt = conn.createStatement();
  try {
    const rs = stmt.executeQuery("SELECT * FROM users WHERE email = '" + email + "'");
    try {
      return rs.next();
    } finally {
      rs.close();
    }
  } finally {
    stmt.close();
  }
}
Not flagged 3 changed lines
/** @param {Jdbc.JdbcConnection} conn */
function findUser(conn, email) {
  const stmt = conn.prepareStatement("SELECT * FROM users WHERE email = ?");
  try {
    stmt.setString(1, email);
    const rs = stmt.executeQuery();
    try {
      return rs.next();
    } finally {
      rs.close();
    }
  } finally {
    stmt.close();
  }
}
MF95020 Warning

HTML markup passed as plain-text email body

The third positional argument to MailApp.sendEmail() and GmailApp.sendEmail() is plain text, so tags like <h1> or <p> arrive as literal text. Pass HTML in the options object under htmlBody instead.

Quick fix: Move the HTML markup into { htmlBody: ... }.

Flagged 1 changed line
function sendWelcome(to) {
  MailApp.sendEmail(to, "Welcome", "<h1>Welcome</h1><p>Your account is ready.</p>");
}
Not flagged 1 changed line
function sendWelcome(to) {
  MailApp.sendEmail(to, "Welcome", "", { htmlBody: "<h1>Welcome</h1><p>Your account is ready.</p>" });
}
MF95021 Suggestion

Drive v3 API call missing Shared Drives flags

Advanced Drive v3 calls such as Drive.Files.get(), list(), update(), copy(), remove(), and Drive.Permissions.create() ignore Shared Drive files unless supportsAllDrives: true is passed (and includeItemsFromAllDrives: true on list()).

Quick fix: Add supportsAllDrives: true (and includeItemsFromAllDrives: true on list()).

GoogleJsonResponseException: drive.files.get File not found

Flagged 1 changed line
function listReports() {
  return Drive.Files.list({ q: "trashed = false" });
}
Not flagged 1 changed line
function listReports() {
  return Drive.Files.list({ q: "trashed = false", supportsAllDrives: true, includeItemsFromAllDrives: true });
}
MF95022 Warning

Document or Presentation exported without saveAndClose()

DocumentApp and SlidesApp buffer edits in memory until saveAndClose() or script exit. Exporting or copying the file through DriveApp before calling saveAndClose() silently produces the old unedited content, and editing after saveAndClose() fails.

Quick fix: Call saveAndClose() before exporting or copying.

Flagged 0 changed lines
function exportReport(docId) {
  const doc = DocumentApp.openById(docId);
  doc.getBody().replaceText("DRAFT", "FINAL");
  return DriveApp.getFileById(docId).getAs("application/pdf");
}
Not flagged 1 changed line
function exportReport(docId) {
  const doc = DocumentApp.openById(docId);
  doc.getBody().replaceText("DRAFT", "FINAL");
  doc.saveAndClose();
  return DriveApp.getFileById(docId).getAs("application/pdf");
}
MF95023 Warning

Lock released after Sheets writes without SpreadsheetApp.flush()

Google Sheets batches writes until SpreadsheetApp.flush() or script termination. Releasing a LockService lock before flushing allows the next waiting execution to read stale cells.

Quick fix: Insert SpreadsheetApp.flush() before lock.releaseLock().

Lock timeout: another process was holding the lock for too long

Flagged 0 changed lines
function appendSafely(row) {
  const lock = LockService.getScriptLock();
  lock.waitLock(10000);
  try {
    SpreadsheetApp.getActiveSheet().appendRow(row);
  } finally {
    lock.releaseLock();
  }
}
Not flagged 1 changed line
function appendSafely(row) {
  const lock = LockService.getScriptLock();
  lock.waitLock(10000);
  try {
    SpreadsheetApp.getActiveSheet().appendRow(row);
    SpreadsheetApp.flush();
  } finally {
    lock.releaseLock();
  }
}
MF95024 Warning

Extra Logger.log() arguments without format placeholders

Logger.log(format, ...values) uses sprintf-style placeholders such as %s, not console.log() multi-argument printing. Extra arguments with no matching placeholder are silently dropped.

Quick fix: Switch to console.log().

Flagged 1 changed line
function logCount(count) {
  Logger.log("Rows processed:", count);
}
Not flagged 1 changed line
function logCount(count) {
  console.log("Rows processed:", count);
}
MF95025 Error

Drive v2 and v3 query field or parameter mismatch

DriveApp.searchFiles() and searchFolders() use Drive API v2 query syntax where the filename field is 'title', not 'name'. Advanced Service Drive v3 uses 'name' and supportsAllDrives instead of 'title' and supportsTeamDrives.

Quick fix: Swap 'name' and 'title' or rename deprecated Drive v2 parameters.

GoogleJsonResponseException: drive.files.list Invalid Value

Flagged 1 changed line
function findReport() {
  return DriveApp.searchFiles("name = 'Report' and trashed = false");
}
Not flagged 1 changed line
function findReport() {
  return DriveApp.searchFiles("title = 'Report' and trashed = false");
}
MF95026 Warning

Unescaped RE2 metacharacters or invalid regex in DocumentApp replaceText/findText

DocumentApp replaceText() and findText() evaluate the search pattern as an RE2 regular expression. Unescaped placeholders like {{name}} or [Client Name] are parsed as quantifiers or character classes, and unclosed brackets throw Invalid regular expression pattern.

Quick fix: Double-escape placeholder delimiters for RE2.

Flagged 1 changed line
function fillTemplate(docId, name) {
  const doc = DocumentApp.openById(docId);
  doc.getBody().replaceText("{{name}}", name);
}
Not flagged 1 changed line
function fillTemplate(docId, name) {
  const doc = DocumentApp.openById(docId);
  doc.getBody().replaceText("\\{\\{name\\}\\}", name);
}
MF95027 Warning

Content-Type placed in UrlFetchApp headers instead of top-level contentType

UrlFetchApp reads contentType from the top-level options object to frame the request body. Setting Content-Type only inside headers can conflict with the default application/x-www-form-urlencoded framing and cause 400 or 415 responses.

Quick fix: Move Content-Type to the top-level contentType option.

Flagged 1 changed line
function sendEvent(data) {
  return UrlFetchApp.fetch("https://api.example.com/events", {
    method: "post",
    headers: { "Content-Type": "application/json" },
    payload: JSON.stringify(data),
  });
}
Not flagged 1 changed line
function sendEvent(data) {
  return UrlFetchApp.fetch("https://api.example.com/events", {
    method: "post",
    contentType: "application/json",
    payload: JSON.stringify(data),
  });
}
MF95028 Error

UrlFetchApp targets localhost or a private network address

Apps Script runs on Google's servers and cannot connect to localhost, 127.0.0.1, .local hostnames, or RFC 1918 private LAN IP addresses. Requests to local hosts always fail with Address unavailable.

Quick fix: None. The message explains the change to make.

Exception: Address unavailable / DNS error

Flagged 2 changed lines
function pingLocal() {
  return UrlFetchApp.fetch("http://localhost:3000/health");
}
Not flagged 2 changed lines
function pingRemote() {
  return UrlFetchApp.fetch("https://api.example.com/health");
}
MF95029 Warning

Utilities byte array coerced directly to a string

Utilities.computeDigest(), computeHmacSha256Signature(), computeHmacSignature(), and base64Decode() return signed Java bytes (number[] from -128 to 127). Coercing that array with +, template literals, or .toString() produces comma-separated integers like '-45,12,...' instead of hex, Base64, or UTF-8 text.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
function signHeader(body, secret) {
  const sig = Utilities.computeHmacSha256Signature(body, secret);
  return "sha256=" + sig;
}
Not flagged 1 changed line
function signHeader(body, secret) {
  const sig = Utilities.computeHmacSha256Signature(body, secret);
  return "sha256=" + Utilities.base64Encode(sig);
}
MF95030 Warning

Drive file or folder shared publicly with edit access

Calling setSharing() with DriveApp.Access.ANYONE or ANYONE_WITH_LINK and DriveApp.Permission.EDIT (or Drive.Permissions.create with type 'anyone' and role 'writer') allows anonymous users on the internet to edit the file.

Quick fix: Change Permission.EDIT to Permission.VIEW (or role 'writer' to 'reader').

Flagged 1 changed line
function publishFile(id) {
  DriveApp.getFileById(id).setSharing(DriveApp.Access.ANYONE_WITH_LINK, DriveApp.Permission.EDIT);
}
Not flagged 1 changed line
function publishFile(id) {
  DriveApp.getFileById(id).setSharing(DriveApp.Access.ANYONE_WITH_LINK, DriveApp.Permission.VIEW);
}
MF95031 Error

BigQuery.Jobs.query() uses Standard SQL without useLegacySql: false

BigQuery REST API v2 defaults useLegacySql to true. Passing a Standard SQL query with backtick-quoted tables, WITH CTEs, UNNEST(), or SAFE_CAST() without useLegacySql: false throws a syntax error at runtime.

Quick fix: Add useLegacySql: false to the BigQuery request object.

GoogleJsonResponseException: bigquery.jobs.query failed

Flagged 0 changed lines
function runQuery(projectId) {
  return BigQuery.Jobs.query({
    query: "SELECT * FROM `my-proj.analytics.events` LIMIT 10",
  }, projectId);
}
Not flagged 1 changed line
function runQuery(projectId) {
  return BigQuery.Jobs.query({
    query: "SELECT * FROM `my-proj.analytics.events` LIMIT 10",
    useLegacySql: false,
  }, projectId);
}
MF95032 Error

Sheets API Values write missing required valueInputOption

Advanced Service Sheets.Spreadsheets.Values.update(), append(), and batchUpdate() require valueInputOption ('USER_ENTERED' or 'RAW'). Omitting it sends INPUT_VALUE_OPTION_UNSPECIFIED and fails with HTTP 400.

Quick fix: Add valueInputOption: "USER_ENTERED".

GoogleJsonResponseException: valueInputOption is required

Flagged 1 changed line
function writeRow(spreadsheetId) {
  Sheets.Spreadsheets.Values.update({ values: [["Ada", 42]] }, spreadsheetId, "Sheet1!A1:B1");
}
Not flagged 6 changed lines
function writeRow(spreadsheetId) {
  Sheets.Spreadsheets.Values.update(
    { values: [["Ada", 42]] },
    spreadsheetId,
    "Sheet1!A1:B1",
    { valueInputOption: "USER_ENTERED" },
  );
}
MF95033 Warning

Sheets API batchUpdate() called with an empty or unguarded requests array

Sheets.Spreadsheets.batchUpdate({ requests }, spreadsheetId) throws HTTP 400 ('Must specify at least one request') when requests is empty. Populate requests or guard the call with if (requests.length > 0).

Quick fix: Guard batchUpdate() with if (requests.length > 0).

Sheets API batchUpdate: Must specify at least one request

Flagged 1 changed line
function formatRows(spreadsheetId, rows) {
  const requests = [];
  for (const row of rows) {
    if (row.flag) {
      requests.push({ autoResizeDimensions: { dimensions: { sheetId: 0, dimension: "COLUMNS", startIndex: 0, endIndex: 1 } } });
    }
  }
  Sheets.Spreadsheets.batchUpdate({ requests }, spreadsheetId);
}
Not flagged 3 changed lines
function formatRows(spreadsheetId, rows) {
  const requests = [];
  for (const row of rows) {
    if (row.flag) {
      requests.push({ autoResizeDimensions: { dimensions: { sheetId: 0, dimension: "COLUMNS", startIndex: 0, endIndex: 1 } } });
    }
  }
  if (requests.length > 0) {
    Sheets.Spreadsheets.batchUpdate({ requests }, spreadsheetId);
  }
}
MF95034 Error

UrlFetchApp URL exceeds the 2,082-character limit

Apps Script caps UrlFetchApp request URLs at 2,082 characters and throws 'Limit Exceeded: URLFetch URL Length' above that limit. Move large parameters into a POST payload instead of the query string.

Quick fix: None. The message explains the change to make.

Exception: Limit Exceeded: URLFetch URL Length

Flagged 2 changed lines
function sendLongQuery() {
  const url = "https://api.example.com/search?q=" + "a".repeat(2100);
  return UrlFetchApp.fetch(url).getContentText();
}
Not flagged 5 changed lines
function sendLongQuery() {
  return UrlFetchApp.fetch("https://api.example.com/search", {
    method: "post",
    contentType: "application/json",
    payload: JSON.stringify({ q: "a".repeat(2100) }),
  }).getContentText();
}
MF95035 Warning

Email message exceeds recipient count or body size limit

MailApp and GmailApp cap messages at 50 recipients per message and 200 KB for plain-text or HTML bodies on consumer accounts (400 KB on Google Workspace), throwing 'Limit Exceeded: Email Recipients Per Message' or 'Email Body Size' above the account tier limit. Split recipient lists into batches and move large content to a Drive link or attachment.

Quick fix: None. The message explains the change to make.

Limit Exceeded: Email Body Size / Recipients Per Message

Flagged 2 changed lines
function sendLargeEmail() {
  const body = "x".repeat(210000);
  MailApp.sendEmail("user@example.com", "Report", body);
}
Not flagged 2 changed lines
function sendLargeEmail() {
  const blob = Utilities.newBlob("x".repeat(210000), "text/plain", "report.txt");
  MailApp.sendEmail("user@example.com", "Report", "See attached report.", { attachments: [blob] });
}
MF95036 Warning

Nullable lookup passed directly into a method that rejects null

GmailApp.getUserLabelByName() and Spreadsheet.getSheetByName() return null when no matching label or tab exists. Passing the call directly to addLabel(), removeLabel(), deleteLabel(), deleteSheet(), or setActiveSheet() throws 'Argument cannot be null'.

Quick fix: Create the label with GmailApp.createLabel() when getUserLabelByName() returns null.

Exception: Argument cannot be null

Flagged 1 changed line
function tagThread(thread) {
  thread.addLabel(GmailApp.getUserLabelByName("Processed"));
}
Not flagged 1 changed line
function tagThread(thread) {
  thread.addLabel(GmailApp.getUserLabelByName("Processed") || GmailApp.createLabel("Processed"));
}

Removed and deprecated services

MF98001 Error

Service that Google shut down

UiApp, DocsList, ScriptDb, FinanceApp, and ContactsApp no longer run. Code that calls them fails, even where the editor still knows their names. Each message names the replacement, such as HtmlService for UiApp and the People advanced service for ContactsApp.

Quick fix: None. The message explains the change to make.

Flagged 2 changed lines
function showDialog() {
  const app = UiApp.createApplication();
  return app;
}
Not flagged 1 changed line
function showDialog() {
  SpreadsheetApp.getUi().showModalDialog(HtmlService.createHtmlOutput("<p>Hello</p>"), "Hello");
}
MF98002 Warning

Deprecated method

Session.getTimeZone(), Session.getUser(), ScriptApp.getProjectKey(), Utilities.jsonParse(), Utilities.jsonStringify(), and the multi-parent DriveApp/Folder addFile/removeFile/addFolder/removeFolder methods are deprecated. Each message names the replacement.

Quick fix: Replace direct 1:1 deprecated calls with their successor.

Flagged 1 changed line
function zone() {
  return Session.getTimeZone();
}
Not flagged 1 changed line
function zone() {
  return Session.getScriptTimeZone();
}

Performance

MF90001 Warning

Range read inside a loop

Calling getValue() or another single-cell getter on each pass of a loop, or in a forEach() or map() callback, makes one service call per cell. Reading the block once with the plural getter is much faster.

Quick fix: Read the range once with the plural getter before the loop, when the loop shape allows it.

Service call inside a loop

Flagged 3 changed lines
function total() {
  const range = SpreadsheetApp.getActiveSheet().getRange(1, 1, 10, 1);
  let sum = 0;
  for (let row = 1; row <= 10; row++) {
    sum += range.getCell(row, 1).getValue();
  }
  return sum;
}
Not flagged 3 changed lines
function total() {
  const values = SpreadsheetApp.getActiveSheet().getRange(1, 1, 10, 1).getValues();
  let sum = 0;
  for (let row = 0; row < values.length; row++) {
    sum += values[row][0];
  }
  return sum;
}
MF90002 Warning

Range write inside a loop

Calling setValue() or another single-cell setter on each pass of a loop, or in a forEach() or map() callback, makes one service call per cell. Collecting a 2D array and writing it once is much faster.

Quick fix: Collect the values and write the range once with the plural setter, when the loop shape allows it.

Flagged 1 changed line
function fill() {
  const range = SpreadsheetApp.getActiveSheet().getRange(1, 1, 10, 1);
  for (let row = 1; row <= 10; row++) {
    range.getCell(row, 1).setValue(row * 2);
  }
}
Not flagged 3 changed lines
function fill() {
  const range = SpreadsheetApp.getActiveSheet().getRange(1, 1, 10, 1);
  const grid = [];
  for (let row = 1; row <= 10; row++) {
    grid.push([row * 2]);
  }
  range.setValues(grid);
}
MF90003 Warning

SpreadsheetApp.flush() inside a loop

flush() forces pending changes to the server. Inside a loop it repeats that round trip on every pass.

Quick fix: Guidance on when flush() can move after the loop.

Flagged 1 changed line
function mark(rows) {
  const sheet = SpreadsheetApp.getActiveSheet();
  for (const row of rows) {
    sheet.getRange(row, 1).setNote("done");
    SpreadsheetApp.flush();
  }
}
Not flagged 1 changed line
function mark(rows) {
  const sheet = SpreadsheetApp.getActiveSheet();
  for (const row of rows) {
    sheet.getRange(row, 1).setNote("done");
  }
  SpreadsheetApp.flush();
}
MF90004 Warning

UrlFetchApp.fetch() inside a loop

Each fetch() waits for the previous request to finish. UrlFetchApp.fetchAll() sends independent requests together.

Quick fix: Guidance on when fetchAll() gives the same result as the loop.

Flagged 5 changed lines
function fetchAll(urls) {
  const bodies = [];
  for (const url of urls) {
    bodies.push(UrlFetchApp.fetch(url).getContentText());
  }
  return bodies;
}
Not flagged 1 changed line
function fetchAll(urls) {
  return UrlFetchApp.fetchAll(urls).map((response) => response.getContentText());
}
MF90008 Warning

Gmail thread search without a limit

GmailApp.search(query), getInboxThreads(), and similar calls without a start and max return every matching thread, and Google notes they fail when the threads are too large to handle. Pass a start and max and page through the results.

Quick fix: Add a start of 0 and a max of 100.

Flagged 1 changed line
function countInvoices() {
  return GmailApp.search("subject:invoice").length;
}
Not flagged 1 changed line
function countInvoices() {
  return GmailApp.search("subject:invoice", 0, 100).length;
}
MF90009 Warning

Same lookup repeated inside a loop

openById(), getSheetByName(), getFileById(), and active-container or UI getters such as getActiveSheet(), getActiveSpreadsheet(), getUi(), and getBody() return the same object on every pass. Inside a loop they repeat the service call unnecessarily.

Quick fix: Move the const above the loop.

Flagged 1 changed line
function stampRows(rows) {
  const ss = SpreadsheetApp.getActive();
  for (const row of rows) {
    const log = ss.getSheetByName("Log");
    log.getRange(row, 2).setValue(new Date());
  }
}
Not flagged 1 changed line
function stampRows(rows) {
  const ss = SpreadsheetApp.getActive();
  const log = ss.getSheetByName("Log");
  for (const row of rows) {
    log.getRange(row, 2).setValue(new Date());
  }
}
MF90010 Warning

appendRow() inside a loop

Each appendRow() is a separate call to Sheets. Collecting the rows and writing them with one setValues() call is much faster for more than a few rows.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
function logOrders(orders) {
  const sheet = SpreadsheetApp.getActiveSheet();
  orders.forEach((order) => sheet.appendRow([order.id, order.total]));
}
Not flagged 2 changed lines
function logOrders(orders) {
  const sheet = SpreadsheetApp.getActiveSheet();
  const rows = orders.map((order) => [order.id, order.total]);
  if (rows.length > 0) sheet.getRange(sheet.getLastRow() + 1, 1, rows.length, 2).setValues(rows);
}
MF90011 Suggestion

Service call in a loop condition

A for or while condition runs before every pass, so sheet.getLastRow() there asks Sheets again each time. The rule stays quiet when the loop body writes to the sheet or calls project functions, since the value may then change.

Quick fix: Read the value into a const before the loop.

Flagged 1 changed line
function logRows() {
  const sheet = SpreadsheetApp.getActiveSheet();
  for (let row = 2; row <= sheet.getLastRow(); row++) {
    Logger.log(row);
  }
}
Not flagged 2 changed lines
function logRows() {
  const sheet = SpreadsheetApp.getActiveSheet();
  const lastRow = sheet.getLastRow();
  for (let row = 2; row <= lastRow; row++) {
    Logger.log(row);
  }
}
MF90012 Warning

Properties read or written one key at a time in a loop

getProperty() and setProperty() each call the Properties service. In a loop, read every value once with getProperties() and write changes together with setProperties().

Quick fix: None. The message explains the change to make.

Flagged 4 changed lines
function saveTotals(totals) {
  const props = PropertiesService.getScriptProperties();
  for (const name of Object.keys(totals)) {
    props.setProperty(name, String(totals[name]));
  }
}
Not flagged 3 changed lines
function saveTotals(totals) {
  const values = {};
  for (const name of Object.keys(totals)) values[name] = String(totals[name]);
  PropertiesService.getScriptProperties().setProperties(values);
}
MF90013 Warning

Cache read or written one key at a time in a loop

get(), put(), and remove() each call the Cache service. getAll(), putAll(), and removeAll() handle many keys in one call.

Quick fix: None. The message explains the change to make.

Flagged 2 changed lines
function cachedNames(ids) {
  const cache = CacheService.getScriptCache();
  return ids.map((id) => cache.get("name:" + id));
}
Not flagged 3 changed lines
function cachedNames(ids) {
  const keys = ids.map((id) => "name:" + id);
  const values = CacheService.getScriptCache().getAll(keys);
  return keys.map((key) => values[key]);
}
MF90014 Suggestion

Mail sent in a loop without a quota check

Apps Script allows 100 email recipients a day on a consumer account and 1,500 on Google Workspace. A loop that sends mail without checking MailApp.getRemainingDailyQuota() fails partway through the list once the quota runs out.

Quick fix: None. The message explains the change to make.

Flagged 0 changed lines
function notify(addresses) {
  for (const address of addresses) {
    MailApp.sendEmail(address, "Report ready", "The weekly report is ready.");
  }
}
Not flagged 1 changed line
function notify(addresses) {
  for (const address of addresses) {
    if (MailApp.getRemainingDailyQuota() === 0) throw new Error("Daily email quota used up at " + address);
    MailApp.sendEmail(address, "Report ready", "The weekly report is ready.");
  }
}
MF90016 Warning

Drive search query does not filter out trashed items

DriveApp.searchFiles() and searchFolders() return items in the trash by default unless the query specifies trashed = false.

Quick fix: Append 'and trashed = false' to the query.

Flagged 1 changed line
function findPdfs() {
  return DriveApp.searchFiles("mimeType = 'application/pdf'");
}
Not flagged 1 changed line
function findPdfs() {
  return DriveApp.searchFiles("mimeType = 'application/pdf' and trashed = false");
}
MF90017 Warning

thread.getMessages() called inside a loop

Calling getMessages() on each GmailThread inside a loop makes one Gmail service call per thread. Batch all threads in a single call with GmailApp.getMessagesForThreads(threads).

Quick fix: None. The message explains the change to make.

Flagged 2 changed lines
function listSubjects() {
  const threads = GmailApp.search("is:unread", 0, 50);
  for (const thread of threads) {
    Logger.log(thread.getMessages().length);
  }
}
Not flagged 3 changed lines
function listSubjects() {
  const threads = GmailApp.search("is:unread", 0, 50);
  const messageGroups = GmailApp.getMessagesForThreads(threads);
  for (const messages of messageGroups) {
    Logger.log(messages.length);
  }
}
MF90018 Suggestion

Unbounded loop over DriveApp.getFiles() or getFolders()

Iterating root DriveApp.getFiles() or getFolders() in a while loop without a continuation token, break, or count limit walks every item in Drive and can exceed the 6-minute execution limit. Scoped calls such as folder.getFiles(), getFilesByName(), and searchFiles() are not flagged.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
function listAllFiles() {
  const files = DriveApp.getFiles();
  while (files.hasNext()) {
    Logger.log(files.next().getName());
  }
}
Not flagged 3 changed lines
function listAllFiles() {
  const files = DriveApp.getFiles();
  let count = 0;
  while (files.hasNext() && count < 100) {
    Logger.log(files.next().getName());
    count++;
  }
}
MF90019 Warning

Unconditional Utilities.sleep() inside a loop

Sleeping unconditionally on every iteration of a data loop burns execution time and risks hitting the 6-minute limit. Calls inside catch blocks, conditional throttles, or retry loops are not flagged.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
function processRows(rows) {
  for (const row of rows) {
    Logger.log(row);
    Utilities.sleep(1000);
  }
}
Not flagged 0 changed lines
function processRows(rows) {
  for (const row of rows) {
    Logger.log(row);
  }
}
MF90015 Suggestion

Open-ended range read

A range such as A2:C or A:A runs to the last row of the sheet, not the last row with data. getValues() then returns a row for every empty row too, often thousands of them, and loops over the result do the same.

Quick fix: End the range at getLastRow().

Flagged 1 changed line
function readOrders() {
  const sheet = SpreadsheetApp.getActiveSheet();
  return sheet.getRange("A2:C").getValues();
}
Not flagged 1 changed line
function readOrders() {
  const sheet = SpreadsheetApp.getActiveSheet();
  return sheet.getRange("A2:C" + sheet.getLastRow()).getValues();
}
MF90020 Warning

GmailThread mutated inside a loop

Calling addLabel(), removeLabel(), moveToArchive(), moveToTrash(), markRead(), or other single-thread mutators inside a loop makes one Gmail RPC per thread. Collect matching threads and batch up to 100 per call with label.addToThreads(threads) or GmailApp.moveThreadsToTrash(threads).

Quick fix: None. The message explains the change to make.

Flagged 3 changed lines
function archiveOld() {
  const threads = GmailApp.search("older_than:30d", 0, 50);
  for (const thread of threads) {
    thread.moveToArchive();
  }
}
Not flagged 1 changed line
function archiveOld() {
  const threads = GmailApp.search("older_than:30d", 0, 50);
  GmailApp.moveThreadsToArchive(threads);
}
MF90021 Warning

Calendar getEventsForDay() called inside a loop

Calling getEventsForDay() on every day in a loop makes one Calendar service call per day and can hit daily rate limits. Fetch the full window once with getEvents(startTime, endTime) and group events in memory.

Quick fix: None. The message explains the change to make.

Flagged 2 changed lines
function listWeek(days) {
  const cal = CalendarApp.getDefaultCalendar();
  return days.map((day) => cal.getEventsForDay(day).length);
}
Not flagged 2 changed lines
function listWeek(start, end) {
  const cal = CalendarApp.getDefaultCalendar();
  return cal.getEvents(start, end).length;
}

Custom functions

MF91001 Warning

Custom function calls a service that needs authorization

Functions marked @customfunction run without user authorization. GmailApp, DriveApp, CalendarApp, and similar services that need it fail inside a formula. UrlFetchApp is supported.

Quick fix: None. The message explains the change to make.

Flagged 2 changed lines
/** @customfunction */
function UNREAD() {
  return GmailApp.getInboxUnreadCount();
}
Not flagged 2 changed lines
/** @customfunction */
function DOUBLE(value) {
  return value * 2;
}
MF91002 Warning

Custom function modifies the spreadsheet

A custom function can only return values. Calls such as setValue(), appendRow(), or insertSheet() fail when Sheets evaluates the formula.

Quick fix: None. The message explains the change to make.

Flagged 2 changed lines
/** @customfunction */
function STAMP() {
  SpreadsheetApp.getActiveSheet().appendRow([new Date()]);
}
Not flagged 2 changed lines
/** @customfunction */
function STAMP(value) {
  return [[value]];
}
MF91003 Warning

Custom function opens a dialog

Formula evaluation has no UI session, so SpreadsheetApp.getUi(), Browser.msgBox(), and Browser.inputBox() fail.

Quick fix: None. The message explains the change to make.

Flagged 2 changed lines
/** @customfunction */
function ASK() {
  return Browser.inputBox("Value?");
}
Not flagged 2 changed lines
/** @customfunction */
function ASK(value) {
  return value;
}
MF91004 Warning

Range method called on a custom function argument

Sheets passes cell values or 2D arrays to custom functions, not Range objects. Calling getValues() on an argument throws a TypeError.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
/** @customfunction
 * @param {number[][]} input
 */
function SUMALL(input) {
  return input.getValues().flat().reduce((a, b) => a + b, 0);
}
Not flagged 1 changed line
/** @customfunction
 * @param {number[][]} input
 */
function SUMALL(input) {
  return input.flat().reduce((a, b) => a + b, 0);
}
MF91005 Warning

Async custom function or returned Promise

Sheets does not await Promises, so the cell shows #VALUE! or [object Promise].

Quick fix: Remove the async keyword.

Flagged 1 changed line
/** @customfunction */
async function LATER(value) {
  return value;
}
Not flagged 1 changed line
/** @customfunction */
function LATER(value) {
  return value;
}
MF91006 Warning

Custom function name ends with an underscore

Names ending in _ are private in Apps Script, so the formula returns #NAME?.

Quick fix: Remove the trailing underscore.

Flagged 1 changed line
/** @customfunction */
function DOUBLE_(value) {
  return value * 2;
}
Not flagged 1 changed line
/** @customfunction */
function DOUBLE(value) {
  return value * 2;
}
MF91007 Warning

Custom function name collides with a built-in formula or cell reference

A custom function named SUM or A1 is shadowed by the built-in formula or read as a cell reference.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
/** @customfunction */
function SUM(value) {
  return value;
}
Not flagged 1 changed line
/** @customfunction */
function SUMOF(value) {
  return value;
}
MF91008 Suggestion

Custom function depends on the time or a random value

Sheets caches a custom function's result until its arguments change, so Math.random(), Date.now(), and new Date() do not refresh.

Quick fix: None. The message explains the change to make.

Flagged 2 changed lines
/** @customfunction */
function ROLL() {
  return Math.random();
}
Not flagged 2 changed lines
/** @customfunction */
function ROLL(seed) {
  return (seed * 9301 + 49297) % 233280;
}
MF91009 Suggestion

Custom function JSDoc @param does not match the parameters

Sheets builds formula help from @param tags, so a missing or misnamed tag hides the argument help.

Quick fix: Add a placeholder @param tag for each undocumented parameter.

Flagged 1 changed line
/**
 * @customfunction
 * @param {number} amount
 */
function TAX(value) {
  return value * 0.2;
}
Not flagged 1 changed line
/**
 * @customfunction
 * @param {number} value
 */
function TAX(value) {
  return value * 0.2;
}
MF91010 Warning

Custom function is not a top-level function declaration

Sheets only finds custom functions declared as top-level function statements, not arrow functions or class methods.

Quick fix: Convert the arrow function to a function declaration.

Flagged 1 changed line
/** @customfunction */
const DOUBLE = (value) => value * 2;
Not flagged 3 changed lines
/** @customfunction */
function DOUBLE(value) {
  return value * 2;
}
MF91011 Suggestion

Custom function reads the active user's email

A custom function runs without the user's authorization, so Session.getActiveUser().getEmail() returns an empty string and the cell shows a blank result.

Quick fix: None. The message explains the change to make.

Flagged 2 changed lines
/** @customfunction */
function WHOAMI() {
  return Session.getActiveUser().getEmail();
}
Not flagged 2 changed lines
/** @customfunction */
function GREETING(email) {
  return "Hello " + email;
}
MF91012 Warning

Custom function returns an object or returns nothing

Google Sheets custom functions can return only primitives (string, number, boolean), Dates, or 1D/2D arrays. Returning a plain object displays [object Object] or #ERROR!, and omitting return leaves the cell blank.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
/** @customfunction */
function STATS(value) {
  return { doubled: value * 2 };
}
Not flagged 1 changed line
/** @customfunction */
function STATS(value) {
  return [[value * 2]];
}

Files and global scope

MF92001 Error

require() is not available

Apps Script has no CommonJS module system, so require() throws ReferenceError at runtime.

Quick fix: None. The message explains the change to make.

Flagged 2 changed lines
function parse(text) {
  const yaml = require("yaml");
  return yaml.parse(text);
}
Not flagged 1 changed line
function parse(text) {
  return JSON.parse(text);
}
MF92002 Error

import or export in a .gs file

Every .gs file runs as a script in one shared global scope. import and export statements are syntax errors when the project saves.

Quick fix: Remove the export keyword or the export list.

Flagged 1 changed line
export function greet(name) {
  return "Hello " + name;
}
Not flagged 1 changed line
function greet(name) {
  return "Hello " + name;
}
MF92008 Error

Private class member

The Apps Script parser rejects private class members such as #count, so saving fails with "ParseError: Unexpected token ILLEGAL" and no file in the project saves.

Quick fix: None. The message explains the change to make.

Flagged 2 changed lines
class Counter {
  #count = 0;
  next() {
    return ++this.#count;
  }
}
Not flagged 4 changed lines
class Counter {
  constructor() {
    this._count = 0;
  }
  next() {
    return ++this._count;
  }
}
MF92003 Warning

Function declared more than once

Files share one global scope, so only the last declaration of a function survives. Which one wins depends on file order.

Quick fix: None. The message explains the change to make.

SyntaxError: Identifier 'X' has already been declared

Flagged 1 changed line
function helper() {
  return 1;
}

function helper() {
  return 2;
}
Not flagged 1 changed line
function helper() {
  return 1;
}

function otherHelper() {
  return 2;
}
MF92005 Error

Browser, Node.js, or Web global in server code

Apps Script runs .gs files on Google's servers without browser, Node.js, or WHATWG globals such as window, document, fetch(), process, Buffer, URL, atob(), btoa(), crypto, or structuredClone(). Each throws a ReferenceError. The message names the Apps Script service to use instead.

Quick fix: Replace fetch(), alert(), btoa(), atob(), crypto.randomUUID(), process.env.<KEY>, or structuredClone() with their Apps Script equivalents.

Flagged 1 changed line
function getRates() {
  const response = fetch("https://api.example.com/rates");
  return JSON.parse(response.getContentText());
}
Not flagged 1 changed line
function getRates() {
  const response = UrlFetchApp.fetch("https://api.example.com/rates");
  return JSON.parse(response.getContentText());
}
MF92006 Warning

Service call outside a function

Apps Script runs every file's top-level code before each function call, including simple triggers and custom functions, which cannot use every service. A service call there runs on every execution, and when it fails, every function in the project fails with it.

Quick fix: None. The message explains the change to make.

Flagged 2 changed lines
const sheet = SpreadsheetApp.getActiveSheet();

function addRow(values) {
  sheet.appendRow(values);
}
Not flagged 1 changed line
function addRow(values) {
  const sheet = SpreadsheetApp.getActiveSheet();
  sheet.appendRow(values);
}
MF92007 Error

Global from a later file used while loading

Apps Script loads files in the order the editor lists them. A class, let, or const declared in a later file does not exist yet while an earlier file's top-level code runs, so using it there throws "is not defined". Code inside functions runs later and is fine. The check runs once the editor knows the file order.

Quick fix: None. The message explains the change to make.

Flagged 3 changed lines
const ORDERS_SHEET = CONFIG.sheetName;

function readOrders() {
  return SpreadsheetApp.getActive().getSheetByName(ORDERS_SHEET).getDataRange().getValues();
}
Not flagged 1 changed line
function readOrders() {
  return SpreadsheetApp.getActive().getSheetByName(CONFIG.sheetName).getDataRange().getValues();
}
MF92009 Error

Top-level await in a .gs file

Apps Script .gs files run as classic scripts, not ES modules, so a top-level await fails to save with a SyntaxError. Move await inside an async function, or call synchronous Apps Script APIs directly.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
const config = await loadConfig();

async function loadConfig() {
  return Promise.resolve({ ready: true });
}
Not flagged 8 changed lines
async function main() {
  try {
    const config = await loadConfig();
    Logger.log(config);
  } catch (error) {
    console.error(error);
  }
}

async function loadConfig() {
  return Promise.resolve({ ready: true });
}
MF92010 Error

Syntax rejected by the Apps Script save-time parser

Apps Script's save-time parser rejects numeric separators (1_000_000), logical assignment operators (??=, ||=, &&=), class field declarations, and class static blocks even though V8 supports them, blocking the entire project from saving.

Quick fix: Strip numeric separator underscores or rewrite logical assignment.

Flagged 1 changed line
function budgetLimit() {
  return 1_000_000;
}
Not flagged 1 changed line
function budgetLimit() {
  return 1000000;
}

HTML pages and templates

MF97001 Error

HTML file not found

createHtmlOutputFromFile() and createTemplateFromFile() look up the file by its exact name, without .html. A name that matches no HTML file in the project throws when the line runs. The check runs once the editor knows every file in the project.

Quick fix: Change the name to the closest HTML file in the project.

No HTML file named X was found

Flagged 1 changed line
function doGet() {
  return HtmlService.createHtmlOutputFromFile("Pages");
}
Not flagged 1 changed line
function doGet() {
  return HtmlService.createHtmlOutputFromFile("Page");
}
MF97002 Warning

Template opened as plain HTML

createHtmlOutputFromFile() serves the file as it is, so <? ?> scriptlets in it show on the page as text. A file with scriptlets needs createTemplateFromFile(...).evaluate().

Quick fix: Switch to createTemplateFromFile(...).evaluate().

Flagged 1 changed line
function doGet() {
  return HtmlService.createHtmlOutputFromFile("Page");
}
Not flagged 1 changed line
function doGet() {
  return HtmlService.createTemplateFromFile("Page").evaluate();
}
MF97003 Warning

Unescaped scriptlet

<?!= prints a value without escaping it. When the value comes from a user, a sheet, or e.parameter, a visitor can put their own HTML or script on the page. <?= escapes the value; keep <?!= for including another file's HTML.

Quick fix: Print the value escaped with <?=.

Flagged 1 changed line
<p>Hello, <?!= name ?></p>
Not flagged 1 changed line
<p>Hello, <?= name ?></p>
MF97004 Warning

Included file printed as text

An include() helper returns another file's HTML. Printing it with <?= escapes that HTML, so the page shows the markup as text instead of the styles or script it holds.

Quick fix: Insert the HTML with <?!=.

Flagged 1 changed line
<head><?= include("Styles") ?></head>
Not flagged 1 changed line
<head><?!= include("Styles") ?></head>
MF97005 Error

google.script.run calls a missing or private function

google.script.run can call only top-level functions of the project whose names do not end in an underscore. A typo or a private function fails in the browser with a 'not a function' error. The check runs once the editor knows every file in the project.

Quick fix: Call the closest server function.

Flagged 1 changed line
<script>
  google.script.run.withSuccessHandler(console.log).getRow();
</script>
Not flagged 1 changed line
<script>
  google.script.run.withSuccessHandler(console.log).getRows();
</script>
MF97006 Warning

Date returned to google.script.run

google.script.run passes numbers, strings, booleans, arrays, and plain objects back to the page. A Date is not one of them, so the call fails and the success handler never runs. Return an ISO string or a formatted date instead.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
function lastRun() {
  return new Date();
}
Not flagged 1 changed line
function lastRun() {
  return new Date().toISOString();
}
MF97007 Warning

Template variable not set before evaluate()

Properties read in <?= ?> or <?!= ?> scriptlets must be assigned on the HtmlTemplate instance before calling evaluate(). Reading a property that was never set (or was set on a different template) produces undefined when the page renders.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
<h1><?= title ?></h1><p><?= username ?></p>
Not flagged 1 changed line
<h1><?= title ?></h1>
MF97008 Suggestion

google.script.run call without a failure handler

When a server function throws or hits a quota or permission error, google.script.run drops the error unless .withFailureHandler() is chained on the call.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
<script>
  google.script.run.withSuccessHandler(console.log).saveRow("Ada");
</script>
Not flagged 1 changed line
<script>
  google.script.run.withSuccessHandler(console.log).withFailureHandler(console.error).saveRow("Ada");
</script>
MF97009 Error

Return value of google.script.run captured or awaited

google.script.run invokes server functions asynchronously and always returns undefined, not a value or Promise. Assigning, returning, or awaiting it yields undefined; pass a callback to .withSuccessHandler() instead.

Quick fix: None. The message explains the change to make.

Flagged 3 changed lines
<script>
  async function load() {
    const total = await google.script.run.getTotal();
    console.log(total);
  }
</script>
Not flagged 2 changed lines
<script>
  function load() {
    google.script.run.withSuccessHandler(console.log).withFailureHandler(console.error).getTotal();
  }
</script>
MF97010 Warning

Unserializable value passed across google.script.run

google.script.run serializes only primitives, arrays, plain objects, and <form> elements. Returning Apps Script host objects (such as Range, Sheet, File, or Blob), Map, Set, or RegExp from a server function, or passing a Date or non-<form> DOM node from the page, fails at runtime.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
function getHeaderRange() {
  return SpreadsheetApp.getActiveSheet().getRange("A1:C1");
}
Not flagged 1 changed line
function getHeaderRange() {
  return SpreadsheetApp.getActiveSheet().getRange("A1:C1").getValues();
}
MF97011 Warning

google.script.run call argument count does not match server function

When google.script.run calls a known project server function with fewer arguments than required parameters or more arguments than the function accepts, missing arguments arrive as undefined and extra arguments are ignored.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
<script>
  google.script.run.withFailureHandler(console.error).saveRow("Ada");
</script>
Not flagged 1 changed line
<script>
  google.script.run.withFailureHandler(console.error).saveRow("Ada", "ada@example.com");
</script>
MF97012 Suggestion

XFrameOptionsMode.ALLOWALL exposes web app to clickjacking

setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL) removes X-Frame-Options protection so any third-party site can embed the web app in an iframe. Keep XFrameOptionsMode.DEFAULT unless cross-origin embedding is required.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
function doGet() {
  return HtmlService.createHtmlOutput("<p>Hello</p>").setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
}
Not flagged 1 changed line
function doGet() {
  return HtmlService.createHtmlOutput("<p>Hello</p>").setXFrameOptionsMode(HtmlService.XFrameOptionsMode.DEFAULT);
}
MF97013 Warning

External link without target or relative URL in HtmlService page

HtmlService pages run inside a sandboxed iframe and do not serve sibling static files by path. External <a href="https://..."> links need target="_top" or target="_blank" to avoid iframe navigation blocks, and relative <script src>, <link href>, or fetch() paths fail to load.

Quick fix: Add target="_blank" rel="noopener noreferrer" to external links.

Flagged 1 changed line
<a href="https://example.com/docs">Documentation</a>
Not flagged 1 changed line
<a href="https://example.com/docs" target="_blank" rel="noopener noreferrer">Documentation</a>
MF97014 Warning

Unescaped request input passed to HtmlService output

Concatenating or interpolating e.parameter values or e.postData.contents directly into HtmlService.createHtmlOutput() or .append() renders untrusted input as raw HTML, allowing reflected XSS. Use HtmlService.createTemplate() or createTemplateFromFile() with <?= ?> so Apps Script escapes HTML.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
function doGet(e) {
  return HtmlService.createHtmlOutput("<p>Hello " + e.parameter.name + "</p>");
}
Not flagged 3 changed lines
function doGet(e) {
  const template = HtmlService.createTemplate("<p>Hello <?= name ?></p>");
  template.name = e.parameter.name;
  return template.evaluate();
}
MF97015 Error

google.script.run handler called instead of passed by reference

Writing withSuccessHandler(onDone()) or withFailureHandler(onFail()) calls the function immediately before the server request starts and discards the server response. Pass the function reference without parentheses.

Quick fix: Remove the trailing () to pass the function reference.

Flagged 1 changed line
<script>
  function onDone(v) { console.log(v); }
  google.script.run.withSuccessHandler(onDone()).withFailureHandler(console.error).getTotal();
</script>
Not flagged 1 changed line
<script>
  function onDone(v) { console.log(v); }
  google.script.run.withSuccessHandler(onDone).withFailureHandler(console.error).getTotal();
</script>
MF97016 Warning

HTML form submit calls google.script.run without preventDefault()

Submitting a <form> inside HtmlService without calling event.preventDefault() or returning false navigates the sandboxed iframe to a blank page and cancels the in-flight google.script.run call.

Quick fix: Insert event.preventDefault() or return false.

Flagged 0 changed lines
<form id="f"><button type="submit">Save</button></form>
<script>
  document.getElementById("f").addEventListener("submit", (e) => {
    google.script.run.withFailureHandler(console.error).saveForm("ok");
  });
</script>
Not flagged 1 changed line
<form id="f"><button type="submit">Save</button></form>
<script>
  document.getElementById("f").addEventListener("submit", (e) => {
    e.preventDefault();
    google.script.run.withFailureHandler(console.error).saveForm("ok");
  });
</script>
MF97017 Warning

google.script.run called inside a loop

Calling google.script.run inside a loop launches many concurrent server executions and can hit Apps Script's hard cap of 30 simultaneous executions per user. Pass the array to a single server function instead.

Quick fix: None. The message explains the change to make.

Flagged 3 changed lines
<script>
  const items = ["a", "b", "c"];
  for (const item of items) {
    google.script.run.withFailureHandler(console.error).saveItem(item);
  }
</script>
Not flagged 1 changed line
<script>
  const items = ["a", "b", "c"];
  google.script.run.withFailureHandler(console.error).saveItems(items);
</script>
MF97018 Error

Malformed Apps Script HTML template scriptlet

Unclosed <? tags, stray ?> closing tags, or JavaScript statements (if, for, var, const) inside printing scriptlets (<?= ?> or <?!= ?>) cause HtmlTemplate.evaluate() to fail with a syntax error at runtime.

Quick fix: Change printing scriptlet <?= to standard scriptlet <?.

Flagged 1 changed line
<?= if (true) { ?><p>Hi</p><? } ?>
Not flagged 1 changed line
<? if (true) { ?><p>Hi</p><? } ?>

Manifest and OAuth scopes

MF96010 Error

Call needs an OAuth scope the manifest does not list

When appsscript.json lists oauthScopes, Apps Script grants only those scopes. A call whose reference page requires a scope missing from the list fails with a permission error at runtime. The check uses the Authorization section of each method's reference page.

Quick fix: Add one of the accepted scopes to oauthScopes in appsscript.json.

Flagged 1 changed line
// appsscript.json: "oauthScopes": ["https://www.googleapis.com/auth/spreadsheets.currentonly"]
function copyTotals() {
  const source = SpreadsheetApp.openById("1AbCdEf");
  return source.getRange("A1").getValue();
}
Not flagged 1 changed line
// appsscript.json: "oauthScopes": ["https://www.googleapis.com/auth/spreadsheets"]
function copyTotals() {
  const source = SpreadsheetApp.openById("1AbCdEf");
  return source.getRange("A1").getValue();
}
MF96011 Suggestion

Listed OAuth scope that no call needs

Every scope in oauthScopes appears on the consent screen, and sensitive scopes can require app verification. A built-in service scope that no call in the project accepts is likely left over. Projects with libraries, advanced services, or add-on or Chat configuration are skipped, since those can need scopes the code does not show.

Quick fix: Remove the scope from oauthScopes.

Flagged 2 changed lines
{
  "runtimeVersion": "V8",
  "oauthScopes": [
    "https://www.googleapis.com/auth/spreadsheets.currentonly",
    "https://www.googleapis.com/auth/drive"
  ]
}
Not flagged 1 changed line
{
  "runtimeVersion": "V8",
  "oauthScopes": [
    "https://www.googleapis.com/auth/spreadsheets.currentonly"
  ]
}
MF96012 Warning

Fetched URL is not in urlFetchWhitelist

When appsscript.json lists urlFetchWhitelist, deployed versions can fetch only URLs under those prefixes. A literal URL passed to UrlFetchApp that no prefix covers fails once the script is deployed.

Quick fix: Add the URL's folder or host to urlFetchWhitelist.

Flagged 1 changed line
// appsscript.json: "urlFetchWhitelist": ["https://api.example.com/v1/"]
function loadRates() {
  return UrlFetchApp.fetch("https://api.example.com/v2/rates").getContentText();
}
Not flagged 1 changed line
// appsscript.json: "urlFetchWhitelist": ["https://api.example.com/v2/"]
function loadRates() {
  return UrlFetchApp.fetch("https://api.example.com/v2/rates").getContentText();
}
MF96004 Warning

Project runs on the Rhino runtime

Without runtimeVersion, or with "STABLE" or "DEPRECATED_ES5", Apps Script runs the legacy Rhino runtime, which lacks modern JavaScript such as classes and arrow functions in some contexts. myFunction checks code as V8.

Quick fix: Set runtimeVersion to "V8".

Flagged 0 changed lines
{
  "timeZone": "America/Denver"
}
Not flagged 1 changed line
{
  "runtimeVersion": "V8",
  "timeZone": "America/Denver"
}
MF96002 Error

Invalid manifest value

A manifest field has the wrong JSON type or a value Apps Script does not accept, such as a web app access level, an exceptionLogging setting, a time zone, or an oauthScopes entry that is not a scope URL.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
{
  "runtimeVersion": "V8",
  "webapp": { "access": "EVERYONE", "executeAs": "USER_DEPLOYING" }
}
Not flagged 1 changed line
{
  "runtimeVersion": "V8",
  "webapp": { "access": "ANYONE", "executeAs": "USER_DEPLOYING" }
}
MF96005 Error

Incomplete library or advanced service entry

Each entry in dependencies.enabledAdvancedServices needs serviceId, userSymbol, and version, and each library needs libraryId, userSymbol, and version. Two entries cannot share a userSymbol.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
{
  "runtimeVersion": "V8",
  "dependencies": {
    "enabledAdvancedServices": [{ "serviceId": "drive", "userSymbol": "Drive" }]
  }
}
Not flagged 1 changed line
{
  "runtimeVersion": "V8",
  "dependencies": {
    "enabledAdvancedServices": [{ "serviceId": "drive", "userSymbol": "Drive", "version": "v3" }]
  }
}
MF96006 Error

Invalid urlFetchWhitelist prefix

Each allowlist prefix must use https://, name a full domain, and have a non-empty path such as a trailing slash. A single * can only stand for the leading subdomain.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
{
  "runtimeVersion": "V8",
  "urlFetchWhitelist": ["https://api.example.com"]
}
Not flagged 1 changed line
{
  "runtimeVersion": "V8",
  "urlFetchWhitelist": ["https://api.example.com/"]
}
MF96003 Warning

Unknown manifest field

appsscript.json accepts a fixed set of top-level fields. A misspelled field, such as oauthScope for oauthScopes, has no effect.

Quick fix: Rename the field to the manifest field it most likely means.

Flagged 1 changed line
{
  "runtimeVersion": "V8",
  "oauthScope": ["https://www.googleapis.com/auth/spreadsheets"]
}
Not flagged 1 changed line
{
  "runtimeVersion": "V8",
  "oauthScopes": ["https://www.googleapis.com/auth/spreadsheets"]
}
MF96001 Error

Manifest is not valid JSON

The Apps Script editor will not save a project whose appsscript.json does not parse. Trailing commas and comments are the usual causes.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
{
  "runtimeVersion": "V8",
  "timeZone": "America/Denver",
}
Not flagged 1 changed line
{
  "runtimeVersion": "V8",
  "timeZone": "America/Denver"
}
MF96013 Suggestion

GmailApp used only to send mail

GmailApp needs the scope to read, send, and delete all of a user's mail. When a project only sends mail with GmailApp.sendEmail() and uses no from address, MailApp.sendEmail() takes the same arguments and asks only to send mail as the user.

Quick fix: Send with MailApp.

Flagged 1 changed line
function notify(to) {
  GmailApp.sendEmail(to, "Report ready", "The weekly report is in the shared folder.");
}
Not flagged 1 changed line
function notify(to) {
  MailApp.sendEmail(to, "Report ready", "The weekly report is in the shared folder.");
}
MF96014 Suggestion

Broader OAuth scope than the code needs

When every call that relies on a listed scope also accepts a narrower one, such as drive.readonly instead of drive, listing the narrower scope gives the script less access and shows users a smaller request. Projects with libraries, advanced services, or add-on configuration are skipped.

Quick fix: Replace the scope with the narrower one.

Flagged 1 changed line
{
  "oauthScopes": ["https://www.googleapis.com/auth/drive"]
}
Not flagged 1 changed line
{
  "oauthScopes": ["https://www.googleapis.com/auth/drive.readonly"]
}
MF96015 Error

Anonymous web app that runs as the visitor

A web app that executes as the user accessing it needs a signed-in user to run as, so it cannot allow anonymous access. Deploy it to execute as you, or require visitors to sign in.

Quick fix: Run the web app as you, or require sign-in.

Flagged 1 changed line
{
  "webapp": { "access": "ANYONE_ANONYMOUS", "executeAs": "USER_ACCESSING" }
}
Not flagged 1 changed line
{
  "webapp": { "access": "ANYONE_ANONYMOUS", "executeAs": "USER_DEPLOYING" }
}
MF96016 Error

Advanced service not turned on

Advanced services such as Drive, Sheets, or Gmail exist only after you add them under Services, which lists them in dependencies.enabledAdvancedServices. Until then, code that uses one throws "is not defined". The check runs when the editor can read appsscript.json.

Quick fix: Add the service to dependencies.enabledAdvancedServices in appsscript.json.

Flagged 1 changed line
// appsscript.json lists no advanced services
function listFiles() {
  return Drive.Files.list({ pageSize: 10 });
}
Not flagged 1 changed line
// appsscript.json: { "userSymbol": "Drive", "version": "v3", "serviceId": "drive" }
function listFiles() {
  return Drive.Files.list({ pageSize: 10 });
}
MF96017 Error

Library not added

Code that calls OAuth2, OAuth1, Cheerio, FirebaseApp, or BetterLog expects the open-source library by that identifier. Until the library is added under Libraries, the identifier is not defined. The check runs when the editor can read appsscript.json.

Quick fix: None. The message explains the change to make.

Flagged 1 changed line
// appsscript.json lists no libraries
function getService() {
  return OAuth2.createService("github");
}
Not flagged 1 changed line
// appsscript.json lists the OAuth2 library
function getService() {
  return OAuth2.createService("github");
}
MF96018 Warning

Library enabled in developmentMode

A library entry with "developmentMode": true runs the library's HEAD code rather than a pinned version, which breaks at runtime for any user who does not have edit access to the library project.

Quick fix: Set developmentMode to false.

Flagged 1 changed line
{
  "runtimeVersion": "V8",
  "dependencies": {
    "libraries": [
      { "libraryId": "1abc", "userSymbol": "MyLib", "version": "1", "developmentMode": true }
    ]
  }
}
Not flagged 1 changed line
{
  "runtimeVersion": "V8",
  "dependencies": {
    "libraries": [
      { "libraryId": "1abc", "userSymbol": "MyLib", "version": "1", "developmentMode": false }
    ]
  }
}
MF96019 Warning

@OnlyCurrentDoc conflicts with calls, oauthScopes, or capitalization

/** @OnlyCurrentDoc */ limits container-bound document access to the active file (*.currentonly), so openById() and openByUrl() fail at runtime unless explicit oauthScopes are listed. When appsscript.json defines oauthScopes, Apps Script silently ignores @OnlyCurrentDoc. Apps Script's parser is also case-sensitive and ignores miscased tags such as @onlyCurrentDoc.

Quick fix: Fix miscased @onlyCurrentDoc capitalization to @OnlyCurrentDoc.

Limit file access with @OnlyCurrentDoc

Flagged 2 changed lines
/** @OnlyCurrentDoc */
function readOther(id) {
  return SpreadsheetApp.openById(id).getName();
}
Not flagged 2 changed lines
/** @OnlyCurrentDoc */
function readActive() {
  return SpreadsheetApp.getActiveSpreadsheet().getName();
}
MF96020 Error

Invalid openLinkUrlPrefixes entry or unallowlisted OpenLink URL

Each entry in addOns.common.openLinkUrlPrefixes (other than standalone '*') must use https:// with a full domain and non-empty path such as a trailing slash. Literal URLs passed to CardService.newOpenLink().setUrl() must match one of the listed prefixes.

Quick fix: Add a trailing slash or add the missing URL prefix to openLinkUrlPrefixes.

Flagged 1 changed line
{
  "runtimeVersion": "V8",
  "addOns": {
    "common": {
      "name": "My Add-on",
      "logoUrl": "https://example.com/logo.png",
      "openLinkUrlPrefixes": ["https://example.com"]
    }
  }
}
Not flagged 1 changed line
{
  "runtimeVersion": "V8",
  "addOns": {
    "common": {
      "name": "My Add-on",
      "logoUrl": "https://example.com/logo.png",
      "openLinkUrlPrefixes": ["https://example.com/"]
    }
  }
}

Type coverage

MF90005 Suggestion

Uncurated API signature

Some Apps Script methods have no verified parameter list yet. myFunction marks the call so you check the reference before adding arguments.

Quick fix: Guidance to check the Apps Script reference before adding arguments.

Flagged 2 changed lines
function clientAction() {
  return AddOnsResponseService.newGmailClientAction();
}
Not flagged 2 changed lines
function message() {
  return AddOnsResponseService.newChatMessage();
}
MF90006 Suggestion

Value typed as any

A declaration or return value typed as any turns off checking for every use of it. Adding a JSDoc type restores completions and diagnostics.

Quick fix: None. The message explains the change to make.

Flagged 0 changed lines
function readConfig(text) {
  const config = JSON.parse(text);
  return config.name;
}
Not flagged 2 changed lines
/** @param {string} text */
function readConfig(text) {
  /** @type {{ name: string }} */
  const config = JSON.parse(text);
  return config.name;
}
MF90007 Warning

@types/google-apps-script type in JSDoc

JSDoc annotations such as GoogleAppsScript.Events.DoPost or GoogleAppsScript.Spreadsheet.Range come from DefinitelyTyped's @types/google-apps-script package. Replacing them with myFunction's global types (Events.DoPost, SpreadsheetApp.Range) uses the runtime-verified declarations directly.

Quick fix: Replace the GoogleAppsScript.* type with the matching global Apps Script type.

Flagged 1 changed line
/** @param {GoogleAppsScript.Events.DoPost} e */
function doPost(e) {
  return ContentService.createTextOutput(e.postData.contents);
}
Not flagged 1 changed line
/** @param {Events.DoPost} e */
function doPost(e) {
  return ContentService.createTextOutput(e.postData.contents);
}