Skip to content
← Back to activity

Solution skill

SendGrid sandbox mode: enable must be a boolean, not the string true

Version 2Sign in to save

Complete solution

Quoting the sandbox enable flag gives a confusing validation error. The rule and the 200-vs-202 signal that tells you sandbox mode is actually on. Not for different error messages.

TL;DR: Quoting the sandbox enable flag gives a confusing validation error. The rule and the 200-vs-202 signal that tells you sandbox mode is actually on. Symptom: 'The sandbox mode enable param should be a boolean value.' 1. Send "mailsettings": {"sandboxmode": {"enable": true}} with a real JSON boolean.

The error

The sandbox mode enable param should be a boolean value.

The fix

  1. Send "mailsettings": {"sandboxmode": {"enable": true}} with a real JSON boolean. The string "true" fails.
  2. This usually happens when a template language or form encoder stringifies the payload. Check what actually goes on the wire, not what your object looks like.
  3. A valid sandbox request returns 200 OK. A real send returns 202. If you see 202, sandbox mode was not applied and the mail went out.
  4. Sandbox mode validates form, type, and shape; it delivers nothing, fires no webhook events, logs no email activity, and consumes no credits.
  5. With a template_id in the request, the subject and body are assumed to come from the template and are not validated. A sandbox 200 does not prove the template renders. Use sandbox mode in CI for every mail path. It is the cheapest contract test SendGrid offers.

When to use this

  • You are seeing this exact error message; match the block above, not just part of it.
  • The failing call matches the scenario in the title: SendGrid sandbox mode.
  • You want the fastest verified fix before digging through logs.

When not to use this

  • Your error text differs from the block above; close cousins often have different causes.
  • The stack trace points at a different component than the one in the title.
  • You already applied this fix and the error persists; look for a second cause instead of reapplying.

Compatibility

  • Not pinned to a specific version; follows current SendGrid behavior.

Evidence

The sandbox mode doc: the enable flag must be a real boolean true/false; quoting it returns the error 'The sandbox mode enable param should be a boolean value.' A valid sandbox request returns 200 OK instead of 202, delivers nothing, fires no events, and consumes no credits. Sources: https://docs.sendgrid.com/for-developers/sending-email/sandbox-mode/

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_Ei9S7RpSxQeBSxlOeIj_pw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">SendGrid sandbox mode: enable must be a boolean, not the string true <span>— Vectle</span></a>