pablo.pazos
03/10/2026, 4:47 PMtylervz
03/10/2026, 5:43 PMgrails-app/migrations/changelog.groovy? Also, what version of Grails are you using and what version of the DBM plugin?wbduque
03/10/2026, 5:56 PMgrails.database.migration.changelog setting in application.yml or Config.groovy.
2. Check Resource Loading: Ensure that if you are using a .groovy changelog, it is located in a directory that is being compiled/copied to your classpath (usually grails-app/conf/migrations/ or src/main/resources/).
3. Liquibase Verbose Logging: Increase logging for liquibase and org.grails.plugins.databasemigration to DEBUG to see exactly what path physicalChangeLogLocation is trying to resolve right before it fails.pablo.pazos
03/10/2026, 8:24 PMgrails-app/migrations/changelog.groovy
"You are getting that because physicalChangeLogLocation did not return anything so .first() throws an exception when there are no elements" I know that, that's why I pointed to the exact line in the code.wbduque
03/10/2026, 8:26 PMpablo.pazos
03/10/2026, 8:27 PMwbduque
03/10/2026, 8:27 PMpablo.pazos
03/10/2026, 8:29 PMpablo.pazos
03/10/2026, 8:29 PMwbduque
03/10/2026, 8:30 PMwbduque
03/10/2026, 8:30 PMwbduque
03/10/2026, 8:31 PMpablo.pazos
03/10/2026, 8:32 PMwbduque
03/10/2026, 8:33 PMpablo.pazos
03/10/2026, 10:45 PMwbduque
03/10/2026, 11:17 PMNoSuchElementException: Cannot access first() element from an empty Iterable is what the Grails database-migration plugin + Liquibase throws internally when updateOnStartFileName points to a file that does not exist, is not on the classpath at runtime, or results in an empty/ unparseable changelog (no databaseChangeLog = { ... } block or no changesets). This matches known behavior reported in the plugin’s GitHub issues (e.g., the same error appears instantly if you give a wrong filename).
### Quick checks/fixes (in order of likelihood)
1. Does the file actually exist?
It must be at:
grails-app/migrations/changelog.groovy
(this is the default changelogLocation + your updateOnStartFileName).
It should start with something like:
groovy
databaseChangeLog = {
// your changesets or includeFile statements here
}
If the file is missing, empty, or just databaseChangeLog = {}, you get exactly this error.
2. Production/WAR deployment issue (very common in Grails 6/7)
In grails run-app (dev) the file is read from disk, so it often works.
In a WAR deployed to Tomcat/JBoss/etc. the grails-app/migrations folder is not automatically on the classpath unless you tell Gradle about it.
Add this to build.gradle before the dependencies block:
groovy
sourceSets {
main {
resources {
srcDir ‘grails-app/migrations’
}
}
}
Then rebuild the WAR (grails war or ./gradlew war) and redeploy.
3. Grails 7 + plugin version
The old grails-database-migration plugin was moved into the GORM Hibernate ecosystem for Grails 7.
Make sure you are on a Grails-7-compatible version (5.x series):
groovy
dependencies {
implementation ‘org.grails.plugins:database-migration:5.0.0’ // or latest from releases
// Strongly recommended – Spring Boot pulls in an older Liquibase
implementation ‘org.liquibase:liquibase-core:4.27.0’ // or whatever the 5.x plugin recommends
}
Also exclude the old Spring Boot CLI dependency if you see conflicts:
groovy
implementation(‘org.grails.plugins:database-migration:5.0.0’) {
exclude module: ‘spring-boot-cli’
}
4. Configuration location
Your YAML looks correct, but just to be sure it ends up in application.yml (or application-prod.yml) as:
yaml
grails:
plugin:
databasemigration:
updateOnStart: true
updateOnStartFileName: changelog.groovy
# optionally:
# changelogLocation: grails-app/migrations # default
Do not use the old grails.plugin.databasemigration. property style in YAML – the nested form you have is fine.
### Other quick things to rule out
- Run grails dbm-validate or grails dbm-update manually – if that also fails with a file-not-found, the file is definitely the problem.
- If you are using contexts, make sure updateOnStartContexts is not filtering everything out.
- Clean and rebuild: grails clean && grails war (or ./gradlew clean bootWar).
After fixing the file location/packaging, the startup migration should run without the first() exception. This exact stack trace has been reported on Grails 6 + Tomcat and is the classic symptom of “changelog file not found at runtime.” Let me know what you see after checking the file existence and the sourceSets addition!wbduque
03/10/2026, 11:18 PM