Applies to:
- Liquibase Pro
- Liquibase Open Source (Community)
Conditions:
- None
Issue Summary:
Liquibase deployment fails with a "Lexical error" (full error message below).
Error Message:
Unexpected error running Liquibase: Lexical error at line x, column x. Encountered: 'xxxxx' (xxxxx), after : ""
Root Cause:
This lexical error points to the specific location of a Unicode character (i.e., �) in the script that is failing.
Resolutions:
Invalid Characters
To resolve this issue for an invalid character that should not be part of your script, the Unicode character will need to be removed from the failing script.
- Review the line number in the error message to indicate where to locate this character in the file.
- Important Note: Often, the character may be found a few lines below the line noted in the error message. There could also be more than one line with a problem character since this error will occur with the first character it encounters.
- If the file is viewed in ANSI encoding, you may not see the character in question. However, switching to UTF-8 encoding or viewing in a code editor, such as VS Code, should show the character.
- Remove the special character from your script.
Special Characters
If the character causing this issue is an intended part of your script, such as an accented letter, the charset can be added to your connection URL.
Example:
...&characterEncoding=Latin1_General_CI_AS;
Improved Error Message
In older versions of Liquibase (prior to version 4.26.0), the error message does not indicate which changeset is causing this error. This was corrected in version 4.26.0.
On older versions of Liquibase, you can isolate the changelog causing this error by enabling `log-level=FINE` and reviewing the logs for the script running before this error occurs.
Comments
0 comments
Article is closed for comments.