{"record":{"id":"a8fa3a6e3ba15070","repo":"hasura/graphql-engine","slug":"getting-list-of-migrations-to-move-w","errorCode":null,"errorMessage":"getting list of migrations to move: %w","messagePattern":"getting list of migrations to move: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/internal/scripts/update-project-v3.go","lineNumber":161,"sourceCode":"\t\tif opts.MoveStateOnly {\n\t\t\topts.EC.Logger.Debug(\"move state only is set, copied state and returning early\")\n\n\t\t\treturn nil\n\t\t}\n\n\t\topts.EC.Logger.Debug(\"completed: copying state from hdb_catalog.schema_migrations\")\n\t}\n\n\topts.EC.Logger.Debug(\"start: copy old migrations to new directory structure\")\n\topts.EC.Spin(\"Moving migrations and seeds to new directories \")\n\t// move migration child directories\n\t// get directory names to move\n\tmigrationDirectoriesToMove, err := getMigrationDirectoryNames(\n\t\topts.Fs,\n\t\topts.MigrationsAbsDirectoryPath,\n\t)\n\tif err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"getting list of migrations to move: %w\", err))\n\t}\n\t// move seed child directories\n\t// get directory names to move\n\tseedFilesToMove, err := getSeedFiles(opts.Fs, opts.SeedsAbsDirectoryPath)\n\tif err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"getting list of seed files to move: %w\", err))\n\t}\n\n\t// create a new directory for TargetDatabase\n\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))","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/internal/scripts/update-project-v3.go#L143-L179","documentation":"Thrown by scripts.UpdateProjectV3 when getMigrationDirectoryNames fails while listing the existing flat migrations/ directory that needs restructuring into migrations/<database>/. The %w wraps a filesystem error — typically the migrations directory doesn't exist or isn't readable.","triggerScenarios":"Running update-project-v3 when the project's migrations directory is missing, unreadable, or is not a directory (e.g. a file named migrations), or the filesystem errors during ReadDir.","commonSituations":"Running the upgrade from the wrong working directory (no migrations/ folder present), permissions issues on the directory, or a repo cloned without the migrations folder.","solutions":["Run the command from the project root that contains the migrations/ directory","If migrations/ was deleted or never existed, create it (mkdir migrations) or restore it from git","Fix read permissions on the directory if the process cannot list it"],"exampleFix":"# before: running from wrong dir\ncd / && hasura scripts update-project-v3  # -> getting list of migrations to move: ...\n\n# after:\ncd my-hasura-project && hasura scripts update-project-v3","handlingStrategy":"validation","validationCode":"if info, err := os.Stat(migrationsDir); err != nil || !info.IsDir() {\n\treturn fmt.Errorf(\"migrations directory %s missing or not a directory\", migrationsDir)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run CLI commands from the project root","Ensure migrations/ exists in the repo (add a placeholder migration if needed)"],"tags":["go","filesystem","migrations","upgrade","hasura-cli"],"backgroundTag":"migrations-directory-not-found","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}