Applies to
- Liquibase Secure (Pro)
- Liquibase Community (Open Source)
Conditions
- Any version of Liquibase Secure (Pro) or Community
- 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
- Liquibase Secure (version 5.0+) example:
<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:secure="http://www.liquibase.org/xml/ns/secure" 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/secure http://www.liquibase.org/xml/ns/secure/liquibase-secure-latest.xsd">
- Liquibase Pro (prior to version 5.0) example:
<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">
- Liquibase Secure (version 5.0+) example:
- 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.