Applies to
- Liquibase Pro
- Liquibase Open Source (Community)
Conditions
- Any version of Liquibase Pro or Open Source
- Using modeled changesets (i.e., YAML, XML, or JSON)
Issue Summary
When running Liquibase, the below error occurs. This error indicates that the Liquibase changeset is missing required syntax.
Error Message
ERROR: Exception Details
ERROR: Exception Primary Class: ClassCastException
ERROR: Exception Primary Reason: java.util.ArrayList cannot be cast to java.util.Map
ERROR: Exception Primary Source: Microsoft SQL Server 15.00.4345
Unexpected error running Liquibase: Error parsing /file/path.yaml : Syntax error in file file/path/changeset.yaml: java.util.ArrayList cannot be cast to java.util.Map
Root Cause
The error is caused by a missing databaseChangeLog:
line at the top of the changeset YAML file. Without this header, Liquibase cannot parse the changeset properly, leading to a type mismatch when interpreting the YAML structure.
This applies to XML and JSON changesets as well. The proper Liquibase changeset syntax is required for YAML, XML, and JSON changesets and changelogs.
Resolution
-
Open the changeset file where the error occurs.
-
Ensure the file begins with the required syntax.
- YAML
-
databaseChangeLog:
-
- XML
-
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd
http://www.liquibase.org/xml/ns/pro
http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd">
-
- JSON
-
{
"databaseChangeLog": [
{
...
-
- YAML
-
Add the appropriate structure underneath if it’s missing.
Example corrected YAML changeset:
-
Save the file and rerun Liquibase.
-
If the error persists, double-check for other syntax issues or indentation problems. YAML is sensitive to formatting, so ensure proper alignment when using a YAML changeset.
You can find full examples for each type here:
Comments
0 comments
Article is closed for comments.