{"record":{"id":"f70318094923dc14","repo":"hasura/graphql-engine","slug":"moving-migrations-to-target-database-directory-w","errorCode":null,"errorMessage":"moving migrations to target database directory: %w","messagePattern":"moving migrations to target database directory: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/internal/scripts/update-project-v3.go","lineNumber":189,"sourceCode":"\ttargetMigrationsDirectoryName := filepath.Join(opts.MigrationsAbsDirectoryPath, targetDatabase)\n\tif err = opts.Fs.Mkdir(targetMigrationsDirectoryName, 0o755); err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"creating target migrations directory: %w\", err))\n\t}\n\n\t// create a new directory for TargetDatabase\n\ttargetSeedsDirectoryName := filepath.Join(opts.SeedsAbsDirectoryPath, targetDatabase)\n\tif err = opts.Fs.Mkdir(targetSeedsDirectoryName, 0o755); err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"creating target seeds directory: %w\", err))\n\t}\n\n\t// move migration directories to target database directory\n\tif err := copyMigrations(\n\t\topts.Fs,\n\t\tmigrationDirectoriesToMove,\n\t\topts.MigrationsAbsDirectoryPath,\n\t\ttargetMigrationsDirectoryName,\n\t); err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"moving migrations to target database directory: %w\", err))\n\t}\n\t// move seed directories to target database directory\n\tif err := copyFiles(\n\t\topts.Fs,\n\t\tseedFilesToMove,\n\t\topts.SeedsAbsDirectoryPath,\n\t\ttargetSeedsDirectoryName,\n\t); err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"moving seeds to target database directory: %w\", err))\n\t}\n\n\topts.EC.Logger.Debug(\"completed: copy old migrations to new directory structure\")\n\n\topts.EC.Logger.Debug(\"start: generate new config file\")\n\topts.EC.Spin(\"Generating new config file \")\n\t// write new config file\n\tnewConfig := *opts.EC.Config\n","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/internal/scripts/update-project-v3.go#L171-L207","documentation":"UpdateProjectV3 could not copy the old per-database migration directories into the newly created target migrations directory. copyMigrations uses util.CopyDirAfero/CopyFileAfero and this error wraps their failure.","triggerScenarios":"`hasura scripts update-project-v3` when a migration directory or file listed for the move cannot be read (permissions, missing after concurrent modification) or written into the new target directory.","commonSituations":"Locked files (Windows/IDE), migrations modified by another process mid-upgrade, disk full, or a stale file list from a partially completed earlier run.","solutions":["Check the wrapped error for the exact file that failed; verify it exists and is readable","Free disk space and close programs holding locks on the migrations directory","Restore a clean backup of migrations/ and re-run the script","Re-run `hasura scripts update-project-v3`"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"for _, d := range migrationDirs {\n    if fi, err := os.Stat(filepath.Join(migrationsDir, d)); err != nil || !fi.IsDir() {\n        return fmt.Errorf(\"missing migration dir %s\", d)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := scripts.UpdateProjectV3(opts); err != nil {\n    if strings.Contains(err.Error(), \"moving migrations to target database directory\") { /* check locked/missing files, retry */ }\n}","preventionTips":["Close editors/tools that lock migration files","Commit migrations to VCS so restore is trivial","Run the upgrade on a quiet tree with no concurrent processes"],"tags":["filesystem","copy","migrations","hasura-cli"],"backgroundTag":"file-copy-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}