{"record":{"id":"6fbeb96679f71dbd","repo":"hasura/graphql-engine","slug":"error-removing-migrations-from-project-w","errorCode":null,"errorMessage":"error removing migrations from project: %w","messagePattern":"error removing migrations from project: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/migrate_delete.go","lineNumber":204,"sourceCode":"\t\t\t}\n\n\t\t\tif v.IsPresent {\n\t\t\t\tsourceVersions = append(sourceVersions, k)\n\t\t\t}\n\t\t}\n\t}\n\n\t// resets the migrations on server\n\terr = migrateDrv.RemoveVersions(serverVersions)\n\tif err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"error removing migration from server: %w\", err))\n\t}\n\n\t// removes the migrations on source\n\tif !o.OnlyServer {\n\t\terr = DeleteVersions(o.EC, sourceVersions, o.Source)\n\t\tif err != nil {\n\t\t\treturn errors.E(op, fmt.Errorf(\"error removing migrations from project: %w\", err))\n\t\t}\n\t}\n\n\to.EC.Spinner.Stop()\n\to.EC.Logger.Infof(\"Deleted migrations\")\n\n\treturn nil\n}\n\nfunc DeleteVersions(ec *cli.ExecutionContext, versions []uint64, source cli.Source) error {\n\tvar op errors.Op = \"commands.DeleteVersions\"\n\n\tfor _, v := range versions {\n\t\tdelOptions := mig.CreateOptions{\n\t\t\tVersion:   strconv.FormatUint(v, 10),\n\t\t\tDirectory: filepath.Join(ec.MigrationDir, source.Name),\n\t\t}\n","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/migrate_delete.go#L186-L222","documentation":"Thrown when deleting the migration files from the project directory fails after server-side removal succeeded (only when --only-server is not set). DeleteVersions removes the version files from the migrations directory on disk.","triggerScenarios":"Read-only migrations directory, permission denied, or files already deleted/renamed so the expected file paths are missing.","commonSituations":"Project directory owned by another user, editor/IDE locking files, out-of-sync disk state after a previous partial delete.","solutions":["Check permissions on the migrations directory (chmod/chown)","Delete the leftover files manually if a prior run half-completed","Re-run migrate status to reconcile disk vs server state"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// pre-flight writability check\nif err := unix.Access(migrationsDir, unix.W_OK); err != nil { log.Fatal(\"read-only migrations dir\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run CLI with write access to the project directory","Use --only-server when disk state is intentionally absent"],"tags":["filesystem","permissions","migrations","hasura"],"backgroundTag":"migration-file-delete-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}