Skip to content

Diagnostic reference

This script has too many triggers

Fix Exception: This script has too many triggers in Google Apps Script by deleting stale triggers, moving trigger setup out of handlers, and staying under 20.

Updated December 6, 2026

Apps Script error

Exception: This script has too many triggers. Triggers must be deleted from the script before more can be added.

What it means

Google Apps Script caps each user at 20 installable triggers per script project. Scripts hit this limit when they call ScriptApp.newTrigger(...).create() inside a recurring handler, inside onOpen()/onEdit(), or when one-off continuation triggers are never deleted after they finish.

Related error messages

  • Exception: This add-on has created too many time-based triggers in this document for this Google user account.

Before and after

The code before and after the fix.

Problem 2 changed lines
function syncOrders() {
  // Bug: creating a new trigger inside the function that runs on every execution.
  ScriptApp.newTrigger('syncOrders').timeBased().everyHours(1).create();
  Logger.log('Syncing orders...');
}
Fixed 8 changed lines
function installSyncTrigger() {
  const existing = ScriptApp.getProjectTriggers().filter(
    (t) => t.getHandlerFunction() === 'syncOrders',
  );
  if (existing.length > 0) return;
  ScriptApp.newTrigger('syncOrders').timeBased().everyHours(1).create();
}

function syncOrders() {
  Logger.log('Syncing orders...');
}

How to fix it

  • Move ScriptApp.newTrigger(...).create() into a dedicated one-time setup function instead of the handler that runs repeatedly.
  • Before creating a trigger programmatically, check ScriptApp.getProjectTriggers() and skip creation (or delete old triggers for that handler) so duplicates never accumulate.
  • For continuation triggers created with ClockTriggerBuilder.after(), delete finished one-off triggers before scheduling the next slice.
  • Open the Triggers panel in the Apps Script editor and delete leftover triggers manually to unblock the project right away.

Things to check

  • The 20-trigger cap is per user per script project; each user who installs triggers in a shared spreadsheet gets their own quota.
  • myFunction flags ScriptApp.newTrigger() calls inside recurring trigger handlers under rule MF93012.

In the Apps Script editor

Catch errors like this before clicking Run.

myFunction (published as Error Checker for Google Apps Script on the Chrome Web Store) checks your code while you edit at script.google.com. Diagnostics, autocomplete, and rule-based quick fixes are free without an account, run in your browser, and request no Google Drive, Gmail, or Apps Script project OAuth scopes. Writing Apps Script with an AI coding agent? Connect the Apps Script MCP server to run the same static checks before pasting code.