{"record":{"id":"e0995bb2e4868433","repo":"hasura/graphql-engine","slug":"unable-to-move-migrations-from-project-for-v","errorCode":null,"errorMessage":"unable to move migrations from project for: %v : %w","messagePattern":"unable to move migrations from project for: (.+?) : %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/migrate_squash.go","lineNumber":326,"sourceCode":"func moveMigrations(\n\tec *cli.ExecutionContext,\n\tversions []uint64,\n\tsource cli.Source,\n\tdestination string,\n) error {\n\tvar op errors.Op = \"commands.moveMigrations\"\n\n\tfor _, v := range versions {\n\t\tmoveOpts := mig.CreateOptions{\n\t\t\tVersion:   strconv.FormatUint(v, 10),\n\t\t\tDirectory: filepath.Join(ec.MigrationDir, source.Name),\n\t\t}\n\n\t\terr := moveOpts.MoveToDir(destination)\n\t\tif err != nil {\n\t\t\treturn errors.E(\n\t\t\t\top,\n\t\t\t\tfmt.Errorf(\"unable to move migrations from project for: %v : %w\", v, err),\n\t\t\t)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc ask2confirmDeleteMigrations(\n\tversions []int64,\n\tsquashedDirectoryName string,\n\tlog *logrus.Logger,\n) bool {\n\tlog.Infof(\"The following migrations are squashed into a new one:\")\n\n\tout := new(tabwriter.Writer)\n\tbuf := &bytes.Buffer{}\n\tout.Init(buf, 0, 8, 2, ' ', 0)\n","sourceCodeStart":308,"sourceCodeEnd":344,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/migrate_squash.go#L308-L344","documentation":"Thrown by moveMigrations during a squash operation when MoveToDir fails to move a version's migration files into the destination directory. The %v is the migration version and %w the underlying filesystem error. It aborts the squash, leaving some versions possibly already moved.","triggerScenarios":"Running 'hasura migrate squash' when the migrations directory for version %v cannot be moved into the destination dir — e.g. permission denied, destination already exists, read-only filesystem, or the migrations dir layout has unexpected files/dirs.","commonSituations":"Non-writable project dir, migrations dir owned by another user, leftover directories from a previous failed squash, running the CLI inside a container with a read-only mount, or path length/character issues on Windows.","solutions":["Check permissions on the migrations directory and destination (chown/chmod) and re-run squash","Clean up partial results of the failed squash (delete leftover destination dirs) and retry","Verify no other process locks the migrations directory (editor, watcher, antivirus) and re-run","If in a container/CI, ensure the project volume is mounted read-write"],"exampleFix":"# before: squash fails with 'unable to move migrations from project for: 42 : ...'\nls -la migrations/  # inspect leftover dirs and permissions\nchmod -R u+w migrations/ && rm -rf migrations/_temp_squash\n# after: re-run the squash command\nhasura migrate squash --name squashed --from 42","handlingStrategy":"validation","validationCode":"// before squashing, verify migration dirs are movable\nfor _, v := range versions {\n    dir := filepath.Join(migrationsDir, fmt.Sprintf(\"%d\", v))\n    if fi, err := os.Stat(dir); err != nil || !fi.IsDir() {\n        return fmt.Errorf(\"migration dir %s missing or not a directory\", dir)\n    }\n    if err := unix.Access(dir, unix.W_OK); err != nil {\n        return fmt.Errorf(\"no write permission on %s\", dir)\n    }\n}","typeGuard":null,"tryCatchPattern":"Catch errors.E around moveMigrations, unwrap with errors.Unwrap to inspect the underlying *os.PathError and decide between retry and abort; report the failing version from the message.","preventionTips":["Keep the migrations dir writable by the CI user","Clean partial squash artifacts before re-running","Avoid running squash concurrently with migrate apply"],"tags":["hasura","migrations","squash","filesystem"],"backgroundTag":"migration-file-move-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}