Email Template Error "Template Cannot Be Rendered: Invalid Content Error"

Overview

This article explains a potential cause of the following 400 Bad Request error when attempting to update an email template using the PATCH/PUT /v2/email-templates/{templateName} endpoint, or when using Deploy CLI or Terraform to manage email templates.

Template Cannot Be Rendered: Invalid Content Error

Applies To

  • Email Templates
  • Terraform
  • Deploy CLI

Cause

This error is typically caused by minor issues in the request body that prevent the email template from rendering correctly. These issues often involve the use of unsupported characters or formatting.

Solution

See the following common issues and their resolutions below:

1. Incorrect Quotation Marks in Template Strings

Using inconsistent or non-standard quotation marks can cause the template rendering to fail.

For example:

  • ’ (U+0027) — Straight single quote (valid)
  • ’ (U+2019) — Curly single quote (invalid)

Ensure that only the straight single quote (', U+0027) is used in template strings, especially in URLs

2. Special Characters Not Escaped Properly

Templates that contain accented or language-specific characters must be HTML-encoded to avoid rendering errors.

Example:

  • Invalid: Merci de vous être inscrit.
  • Valid: Merci de vous être inscrit. (ê encoded as ê)