Applies to
- Liquibase Pro
Issue Summary
Running the update-one-changeset
and update-one-changeset-sql
commands fail with an error indicating that the specified changeset was not found, even though the changeset exists at the specified file path. This may be confusing for users who are confident they’ve specified the correct path, author, and ID.
Error Message
Unexpected error running Liquibase: The changeset targeted by '{ID}::{author}::{file_path}
' was not found.
Note: The trailing newline within the single quotes is part of the issue.
Root Cause
The error is caused by a trailing line break (newline character) at the end of the value provided for the --changeset-path
parameter. When this happens, Liquibase interprets the path literally, including the line break, which causes it to fail to match the changeset definition in the changelog.
This often occurs when using shell variables like $SCRIPT_PATH
where the variable was defined with a line break at the end (for example, via copy-pasting or a command like echo "some/path.sql"
without -n
).
Resolution
First, it's important to verify that the author, ID, and changeset file path provided in your command are correct.
Verify that the value passed into --changeset-path
does not include any trailing whitespace or newline characters. You can trim the newline using command-line tools or adjust how the variable is defined.
Example of a failing command:
liquibase --strict=false update-one-changeset-sql --changeset-author="lora" --changeset-id="001" --changeset-path="changelogs/test/changelog.sql
"
Example of the same failing command, corrected:
liquibase --strict=false update-one-changeset-sql --changeset-author="lora" --changeset-id="001" --changeset-path="changelogs/test/changelog.sql"
Preventing this Issue
If your pipeline script takes an input for the changeset-path
parameter, it's recommended that you sanitize the input to ensure there are no trailing line breaks.
Example in Bash:
# If using a variable for the path, trim the newline like this:
SCRIPT_PATH=$(echo -n "$SCRIPT_PATH")
Comments
0 comments
Article is closed for comments.