hasura/graphql-engine · critical
applying migrations failed on database(s): %s
Error message
applying migrations failed on database(s): %s
What it means
`hasura migrate apply` attempts migrations across the requested sources and collects names of databases whose migration run returned an error. If any failed, it reports the comma-joined list; the per-source error details were already logged above.
Source
Thrown at cli/commands/migrate_apply.go:268
if err != nil {
return herrors.E(op, err)
}
var failedSources []string
for result := range results {
if result.Error != nil {
failedSources = append(failedSources, result.DatabaseName)
o.EC.Logger.Errorf("%v", result.Error)
} else if len(result.Message) > 0 {
o.EC.Logger.Infof("%s", result.Message)
}
}
if len(failedSources) != 0 {
return herrors.E(
op,
fmt.Errorf(
"applying migrations failed on database(s): %s",
strings.Join(failedSources, ","),
),
)
}
return nil
}
type MigrateApplyResult struct {
DatabaseName string
Message string
Error error
}
func (o *MigrateApplyOptions) Apply() (chan MigrateApplyResult, error) {
var op herrors.Op = "commands.MigrateApplyOptions.Apply"
View on GitHub (pinned to 724551b9ae)
Solutions
- Scroll up in the output for the per-database error — this message only lists which sources failed
- Fix the offending migration file or database state for each listed source
- Run `hasura migrate status --database-name <failed>` to inspect version chain state
- For history inconsistencies, consider `hasura migrate delete --up-to <version>` or squashing
Defensive patterns
Strategy: try-catch
Validate before calling
hasura migrate status --database-name "$DB"
Try / catch
err := applyCmd.Execute(); if err != nil && strings.Contains(err.Error(), "applying migrations failed on database(s)") { for _, db := range strings.Split(extractList(err), ",") { fmt.Println("check logs for", db) } } Prevention
- Run migrate status per database before apply
- Test migration files against each target database kind locally
When it happens
Trigger: One or more sources return an error during their migration execution loop (bad SQL in a version file, connection failure to the database, version-chain conflict).
Common situations: A migration file fails against one database (e.g. PG syntax on a BigQuery source) while others succeed; database credentials changed; inconsistent migration history on the server.
Related errors
- determining database kind of '%s': %w
- error determining database kind for '%s', check if database
- skipping applying migrations on database '%s', encountered:
- skipping applying migrations on database '%s', encountered:
- error validating flags: %w
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/906e71b3270f3426.
Report an issue: GitHub.