What causes syntax errors, and how to fix them.
Syntax errors can occur in both sequences & broadcasts, and they must be resolved before the email can be sent.
The appearance of the error message itself will vary depending on the cause of the error, and where you are in the app. Here's an example:
These are all usually related to the same type of issue, and the process for troubleshooting them is the same!
How's that for some good news?
Let's dive in.
First, what is a syntax error?
A syntax error is a code error that prevents that code from being able to run. Syntax errors can be (and often are) caused by something simple like a typo or an extra space where there shouldn't be one.
In context of Kit emails, syntax errors will be referring to Liquid code snippets contained within your emails. Liquid is the coding language used for things like our personalization & conditional content features.
Even if you added the code directly from our content block menu, syntax errors can still occur by accident (for example, if you accidentally delete a character and don't notice).
Below is an example of our conditional tag code with a syntax error. Can you catch where? 👀
If you guessed the bracket missing at the end, you're right! You wouldn't be able to save or send that email until the issue causing the code to break (i.e. the missing bracket) is resolved.
As you can probably tell, syntax errors can seem minor and be very easy to overlook—but luckily, they are also fixable!
How to fix syntax errors
Typically, the most straightforward way to resolve syntax errors is to remove the code altogether and then re-add it.
For example, if the only Liquid code in your email is our first name personalization code, try simply removing it and then re-adding it from the personalization menu. The new code that gets added won't contain any errors, so it's like a fresh start!
If you're a more experienced coder, you might want to take a closer look at the code first and see if you can catch any issues, like missing brackets or misplaced characters. But if coding isn't your forté, removing & re-adding the code is often the fastest fix.
☝️TIP: If you have content within the code that you don't want to lose, paste it somewhere else first before removing it. That way you can easily copy it back in to the appropriate spot once the code error is fixed.
Still having trouble?
If you can't identify the cause of a syntax error, please reach out to us with a screenshot of the code and the error message you're getting, and we'll take a look!