hasura/graphql-engine · error
error creating migration files: %w
Error message
error creating migration files: %w
What it means
Final step of `hasura migrate create`: createOptions.Create() writes the migration files (up.sql/down.sql) into migrations/<name>/. This wraps filesystem errors during that write, after the spinner is stopped.
Source
Thrown at cli/commands/migrate_create.go:302
}
if !o.downSQLChanged {
createOptions.SQLDown = []byte(``)
}
}
defer func() {
if err != nil {
err := createOptions.Delete()
if err != nil {
o.EC.Logger.Warnf("cannot delete dangling migrations: %v", err)
}
}
}()
err = createOptions.Create()
if err != nil {
return 0, herrors.E(op, fmt.Errorf("error creating migration files: %w", err))
}
o.EC.Spinner.Stop()
o.EC.Logger.Infof("Created Migrations")
if o.fromServer {
opts := &MigrateApplyOptions{
EC: o.EC,
SkipExecution: true,
VersionMigration: strconv.FormatInt(timestamp, 10),
Source: o.Source,
}
err := opts.Run()
if err != nil {
o.EC.Logger.Warnf("cannot mark created migration %d as applied: %v", timestamp, err)
o.EC.Logger.Warnf(
"manually mark it as applied using command: hasura migrate apply --skip-execution --version %d",View on GitHub (pinned to 724551b9ae)
Solutions
- Ensure migrations/<database>/ exists and is writable: mkdir -p migrations/<name> && chmod u+w migrations/<name>
- Run from a writable clone/checkout
- Freeze check: df -h if disk is full; remove half-written migration dirs from the failed attempt
Defensive patterns
Strategy: validation
Validate before calling
mkdir -p "migrations/$DB" && test -w "migrations/$DB" || { echo 'migrations dir not writable'; exit 1; } Prevention
- Ensure CI checkouts are writable where migrations are created
- Clean partial migration dirs after failed creates
When it happens
Trigger: migrations directory or migrations/<source>/ is read-only, missing, or a name collision occurs; disk full; permission denied.
Common situations: Running in CI with a read-only checkout; directory removed manually; ownership issues after cloning as another user.
Related errors
- error generating codegen for action %s: %w
- error in fetching codegen frameworks: %w
- error in copying starter kit: %w
- error in writing config: %w
- unable to create directory: %w
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/65da4f6db2847b41.
Report an issue: GitHub.