Skip to content

Diagnostic reference

Missing required GmailApp arguments

Why GmailApp.createDraft reports 'Expected 3-4 arguments, but got 0', which arguments it needs, and how to fix the call before running the script.

Updated August 30, 2026

What myFunction reports

Expected 3-4 arguments, but got 0.

What it means

GmailApp.createDraft needs a recipient, subject, and body. Apps Script cannot create the draft when those values are absent. The language server reports the incomplete call while the code is still an unsaved editor change.

Before and after

See the change before you make it.

Problem
function createWelcomeDraft() {
  GmailApp.createDraft();
}
Safer version
function createWelcomeDraft() {
  GmailApp.createDraft(
    'person@example.com',
    'Welcome',
    'Thanks for joining us.',
  );
}

What the assist changes

  • Adds example values for the required recipient, subject, and body positions.
  • Keeps the change in the open editor so the complete call is visible before you save.
  • Uses the existing GmailApp overload instead of inventing a wrapper or changing project structure.

What stays with you

  • Replace every example value with the real recipient and message content.
  • Review the recipient before saving or running the script.
  • myFunction does not create or send the draft, and it does not authorize Gmail access.