hasura/graphql-engine · error
unable to delete migrations from project for: %v : %w
Error message
unable to delete migrations from project for: %v : %w
What it means
Per-version error in DeleteVersions when delOptions.Delete() fails to delete an individual migration file from the project for a given version v. Wraps the underlying filesystem error.
Source
Thrown at cli/commands/migrate_delete.go:227
o.EC.Logger.Infof("Deleted migrations")
return nil
}
func DeleteVersions(ec *cli.ExecutionContext, versions []uint64, source cli.Source) error {
var op errors.Op = "commands.DeleteVersions"
for _, v := range versions {
delOptions := mig.CreateOptions{
Version: strconv.FormatUint(v, 10),
Directory: filepath.Join(ec.MigrationDir, source.Name),
}
err := delOptions.Delete()
if err != nil {
return errors.E(
op,
fmt.Errorf("unable to delete migrations from project for: %v : %w", v, err),
)
}
}
return nil
}
View on GitHub (pinned to 724551b9ae)
Solutions
- Check the wrapped filesystem error and the file for version v
- Fix permissions or unlock the file
- Remove the file manually and re-run
Defensive patterns
Strategy: try-catch
Validate before calling
// ensure each version file exists before delete
for _, v := range versions {
if _, err := os.Stat(fmt.Sprintf("%d_*", v)); err != nil { /* skip or fix */ }
} Try / catch
for _, v := range versions {
if err := delOptions.Delete(); err != nil { log.Printf("skip %d: %v", v, err); continue }
} Prevention
- Don't rename migration files manually
- Commit all migration files to version control
When it happens
Trigger: Deleting migration files one by one and one file is missing, read-only, or otherwise unremovable (os.Remove error).
Common situations: Files manually moved/renamed, NFS/locked filesystems, running without write permission on the migrations directory.
Related errors
- error removing migrations from project: %w
- unable to move migrations from project for: %v : %w
- found duplicate migrations for version %d - %s - %s
- cannot read file %s: %w
- operation failed: %w
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/f20e9190b517bacf.
Report an issue: GitHub.