cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Aditi.Sinha
AppDynamics Team

How do I resolve a “Lexical error , Encountered:” when using the Controller’s email/HTTP template? 

While using the email/HTTP template in the Controller, you may see the following error:

ERROR Lexical error, Encountered: "#" (35), after : "&" at *unset*… or
Lexical error, Encountered: after :... 

 

The error below can be seen when the template associated with an action is incorrect: 

AditiSinha_0-1683776697926.png

 

 What is the cause of the lexical error, and how do I resolve it? 

This lexical error generally occurs when double quotes have been used in the #set variable instead of single quotes. To repair it, change the #set variable to use single quotes. 

TIP | If you are using an HTML body in an email template, use a toggle button and then paste in the payload to avoid any issue 

Example of a payload that will result in a lexical error: 

 

 

#set( $em = ${latestEvent.eventMessage}) 
#set( $em = $em.replace("\", "\\")) 
#set( $em = $em.replace("<b>", "*")) 
#set( $em = $em.replace("</b>", "*")) 
#set( $em = $em.replace("<br>", '' '))

 

 

Screenshots showing both correct and incorrect payloads

This screenshot shows the incorrect use of double quotes in the payload.This screenshot shows the incorrect use of double quotes in the payload. 

This screenshot shows the correct use of single quotes in the payload — in this case, on the Alert & Respond tab on the ControllerThis screenshot shows the correct use of single quotes in the payload — in this case, on the Alert & Respond tab on the Controller

This screenshot shows a successful transcript example, resulting from the correctly input (single quote) payload as shown in screenshot 2, aboveThis screenshot shows a successful transcript example, resulting from the correctly input (single quote) payload as shown in screenshot 2, above

Version history
Last update:
‎05-11-2023 09:53 AM
Updated by:
On-Demand Webinar
Discover new Splunk integrations and AI innovations for Cisco AppDynamics.


Register Now!

Observe and Explore
Dive into our Community Blog for the Latest Insights and Updates!


Read the blog here