How to interpret personalization errors?

You may find different types of errors when writing dynamic content. Here’s a list of the errors you may find and an explanation for each of them.

“Illegal char…”

Meaning: A character appeared where only a name, number, separator, or part of a string was expected.

Typical Causes:

  • Using the string delimiter (') or variable prefix ($) in the wrong place.

  • Mixing double quotes where the language requires single quotes.

  • Introducing a non-alphanumeric character while building an identifier or a number.

Examples:

👉 {% if trigger_event.name == “John” %} instead of {% if trigger_event.name == 'John' %}

The issue is the double quotes “”.

👉price $ 30 instead of price == 30

$ on its own becomes an illegal char.

“Illegal token…”

Meaning: A symbol of this type is not allowed in this part of the code.

Typical Causes

  • Forgetting a comma between arguments.

  • Using the wrong operator.

Examples:

👉 price => 3 instead of price >= 3

The correct operator is >=.

👉 {% set $product = lookup('products' '1') %} instead of

{% set $product = lookup('products', '1') %}

There should be a comma between the catalog name ‘products’ and the catalog id ‘1’.

“Unbalanced parenthesis…”

Meaning: Closing a parenthesis incorrectly or without valid arguments.

Example :

👉{% set $product = lookup('products', '1' %} instead of

{% set $product = lookup('products', '1') %}

The second parenthesis after the catalog id ‘1’ is missing.

“Unbalanced sections…”

Meaning: The control block was not properly closed.

Example:

👉 {% if age > 5 %} CONTENT instead of {% if age > 5 %} CONTENT {% endif %}

The closing block {% endif %} is missing.

“Unbalanced string…” :

Meaning: A string was opened but not properly closed.

Example:

👉 {% if name == 'XYZ %} instead of {% if name == 'XYZ' %}

The closing quote is missing.

“Illegal attribute/tag/event name …”

Meaning: The name doesn’t match the expected format, scope, or permissions.

Example:

👉 user..age instead of u.age or age

The format of the attribute is incorrect.

“A var name and then the equal operator was expected”

Meaning: After {% set, there must be a $variable followed by =.

Example:

👉 {% set = 3 %} instead of {% set $user_id = 3 %}

The $variable is missing.

“A var name and then the 'in' keyword was expected”

Meaning: After {% for, there must be a variable followed by in.

Example:

👉 {% for $item list %} instead of {% for $item in list %}

The in is missing.

“The body can't be empty”

Meaning: The block associated with an if, else if, else or for is empty.

Example:

👉{% if condition %}{% endif %} instead of {% if condition %}CONTENT{% endif %}

There is no content between the display conditions (for dynamic content in SMS, push and In-App).

“Illegal sign operator”

Meaning:

+ or - is used in front of a value that is not a number.

Example:

👉 {% if -true > user_score %} instead of {% if -4 > user_score %}

true is not a number, and therefore -true is not valid.

“Invalid filter”

Meaning: The filter used to transform the argument is incorrect.

Example:

👉{% if first_name|title(nullIfEmpty:true) != None %} instead of

{% if first_name|trim(nullIfEmpty:true) != None %}

The filter title(nullIfEmpty:true) is incorrect.

“Illegal end of string…”

Meaning: The string ends too early due to a closing parenthesis missing or placed incorrectly.

Example:

👉 hello {{first_name instead of hello {{first_name}}

The closing parenthesis is missing.

“Illegal decimal separator…”

Meaning: The symbol used to separate the whole part from the fractional part of a number is incorrect.

Example:

👉 {% if age > 1..5 %} instead of {% if age > 1.5 %}

The decimal is incorrect.

“Illegal unit char…”

Meaning: A character that isn’t allowed appeared inside a unit (the part that describes measurement like kg, ms, cm).

Example:

👉{% if distance > 10km@ %} instead of {% if distance > 10km %}

The unit is incorrect.

“Unable to parse this constant…”

Meaning: The system couldn’t read the constant because it’s malformed or contains invalid characters.

Example:

👉 {% if subscription_date == 90days %} instead of {% if subscription_date == 90d %}

The constant days is incorrect.

“Partial tag… is not allowed”

Meaning: A partial tag is a tag whose full set of values cannot be listed. If a tag is partial (like b.custom_audiences), you cannot use it where the system must enumerate or join all values.

Example:

👉 {{ b.custom_audiences | join(", ") }}

The system cannot return the complete list of audiences for an installation.

Last updated