hasura/graphql-engine · error
down migration with SQL string could not be created: %w
Error message
down migration with SQL string could not be created: %w
What it means
Mirror of error 116 for the --down flag: createOptions.SetSQLDown(o.downSQL) failed while validating/storing the down SQL string, typically because it is empty or whitespace-only.
Source
Thrown at cli/commands/migrate_create.go:275
}
// create pure sql based migrations here
if o.upSQLChanged {
err = createOptions.SetSQLUp(o.upSQL)
if err != nil {
return 0, herrors.E(
op,
fmt.Errorf("up migration with SQL string could not be created: %w", err),
)
}
}
if o.downSQLChanged {
err = createOptions.SetSQLDown(o.downSQL)
if err != nil {
return 0, herrors.E(
op,
fmt.Errorf("down migration with SQL string could not be created: %w", err),
)
}
}
if o.sqlFile == "" && !o.sqlServer && o.EC.Config.Version != cli.V1 {
// Set empty data for [up|down].sql
if !o.upSQLChanged {
createOptions.SQLUp = []byte(``)
}
if !o.downSQLChanged {
createOptions.SQLDown = []byte(``)
}
}
defer func() {
if err != nil {
err := createOptions.Delete()View on GitHub (pinned to 724551b9ae)
Solutions
- Verify the --down value is non-empty SQL
- Omit --down entirely if no down migration is needed (a default empty down may be created)
- Fix shell quoting/variable expansion
Defensive patterns
Strategy: validation
Validate before calling
[ -n "$(echo "$DOWN_SQL" | tr -d '[:space:]')" ] || { echo 'empty --down'; exit 1; } Prevention
- Omit --down when no down migration exists
- Validate both up/down variables in wrappers
When it happens
Trigger: `hasura migrate create X --down ""` or --down "$DOWN" with DOWN unset/empty.
Common situations: Scripts that always pass both --up and --down but the down variable is conditionally empty.
Related errors
- up migration with SQL string could not be created: %w
- expected 0 arguments, found: %v
- error validating flags: %w
- not a valid input for steps/version: %w
- cannot create migrate instance: %w
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/b18f21d775497379.
Report an issue: GitHub.