hasura/graphql-engine · error

removing up original migrations: %w

Error message

removing up original migrations: %w

What it means

After copying migrations into the new structure, UpdateProjectV3 failed deleting the original migration directories (removeDirectories). The message ('removing up original migrations') is used for the migrations removal step.

Source

Thrown at cli/internal/scripts/update-project-v3.go:224

	newConfig := *opts.EC.Config

	newConfig.Version = cli.V3
	if err := opts.EC.WriteConfig(&newConfig); err != nil {
		return errors.E(op, err)
	}

	opts.EC.Config = &newConfig
	opts.EC.Logger.Debug("completed: generate new config file")

	opts.EC.Logger.Debug("start: delete old migrations and seeds")
	opts.EC.Spin("Cleaning project directory ")
	// delete original migrations
	if err := removeDirectories(
		opts.Fs,
		opts.MigrationsAbsDirectoryPath,
		migrationDirectoriesToMove,
	); err != nil {
		return errors.E(op, fmt.Errorf("removing up original migrations: %w", err))
	}
	// delete original seeds
	if err := removeDirectories(opts.Fs, opts.SeedsAbsDirectoryPath, seedFilesToMove); err != nil {
		return errors.E(op, fmt.Errorf("removing up original migrations: %w", err))
	}
	// remove functions.yaml and tables.yaml files
	metadataFiles := []string{"functions.yaml", "tables.yaml"}
	if err := removeDirectories(opts.Fs, opts.EC.MetadataDir, metadataFiles); err != nil {
		return errors.E(op, err)
	}

	opts.EC.Logger.Debug("completed: delete old migrations and seeds")

	opts.EC.Logger.Debug("start: export metadata from server")
	opts.EC.Spin("Exporting metadata from server ")

	var files map[string][]byte

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Check the wrapped remove error for the specific path; close programs locking it
  2. Fix write permissions on the migrations directory (removal requires directory write access)
  3. Manually remove the leftover directories and re-run or continue the setup manually
  4. Re-run the script from a clean checkout
Defensive patterns

Strategy: try-catch

Try / catch

if err := scripts.UpdateProjectV3(opts); err != nil {
    if strings.Contains(err.Error(), "removing up original migrations") { /* check locks/perm on migrations dir, finish cleanup manually */ }
}

Prevention

When it happens

Trigger: `hasura scripts update-project-v3` when an original migration directory under opts.MigrationsAbsDirectoryPath cannot be removed (permissions, non-empty due to hidden files, file locks).

Common situations: Windows file locks from editors/AV, read-only attributes, or files created in migration dirs by other tools during the upgrade.

Related errors


AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28). Data as JSON: /api/errors/13a43d4282b8d733. Report an issue: GitHub.