Skip to main content

Calculator Validation Error - Unexpected Token

Calculator Validation Error (Unexpected Token) explained.

Praise Magidi avatar
Written by Praise Magidi
Updated yesterday

Step

Calculator

Message

Parsing error: Unexpected Token (or other syntax-related issues).

Cause

This error occurs when the JavaScript code in the Calculator step contains syntax errors or invalid expressions. Common causes include:

  • Missing brackets, parentheses, or semicolons.

  • Using unsupported JavaScript functions or syntax.

  • Returning an invalid or undefined value.

Resolution

1. Check for Syntax Errors:

Ensure all brackets {}, parentheses (), and quotes "" are properly closed.

Verify that all statements end with a semicolon (;) if required.

2. Validate the Return Value:

The Calculator step must return a valid value (e.g., return inputRecord;).

If modifying the default code, test small changes incrementally.

3. Use the Validate Button:

Click Validate to check for errors before saving.

If the error persists, simplify the code and test again.

4. Review Supported Functions:

Ensure any custom JavaScript uses supported utilities (utils, stringHelper, flatSchemaUtils).

If the issue continues, consult JavaScript documentation or contact Synatic support.

##

Error Detail

{
"message": "Parsing error: Unexpected Token",
"statusCode": 400,
"error": {
"type": "SyntaxError",
"details": "Unexpected token '}' at line 5"
}
}
Did this answer your question?