hasura/graphql-engine · error

error in creation of new migrate instance %w

Error message

error in creation of new migrate instance %w

What it means

Returned when migrate.NewMigrate fails to construct the migrations driver for `hasura migrate delete`. This initializes filesystem + server state for the given source, so an invalid source name/kind or an unreachable server triggers it.

Source

Thrown at cli/commands/migrate_delete.go:163

	o.Source = o.EC.Source

	err := o.RunOnSource()
	if err != nil {
		return errors.E(op, err)
	}

	return nil
}

func (o *MigrateDeleteOptions) RunOnSource() error {
	var op errors.Op = "commands.MigrateDeleteOptions.RunOnSource"

	o.EC.Spin("Deleting migration...")

	migrateDrv, err := migrate.NewMigrate(o.EC, true, o.Source.Name, o.Source.Kind)
	if err != nil {
		return errors.E(op, fmt.Errorf("error in creation of new migrate instance %w", err))
	}

	status, err := migrateDrv.GetStatus()
	if err != nil {
		return errors.E(op, fmt.Errorf("error while retrieving migration status %w", err))
	}

	// sourceVersions migration versions in source to be deleted similarly with serverVersions
	var sourceVersions, serverVersions []uint64

	if !o.All {
		// if o.version isn't present on source and on server return error version isn't present.
		if _, ok := status.Migrations[o.Version]; !ok {
			return errors.E(op, fmt.Errorf("version %v not found", o.Version))
		}

		sourceVersions = []uint64{o.Version}
		serverVersions = []uint64{o.Version}

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Verify the database name exists in config.yaml / the server's sources
  2. Confirm endpoint and admin secret are correct
  3. Run `hasura migrate status` to confirm the driver initializes
  4. Upgrade CLI to match the server version
Defensive patterns

Strategy: validation

Validate before calling

// confirm database exists in config before running
hasura migrate status --database-name <db>

Prevention

When it happens

Trigger: Passing --database-name that doesn't exist in the project config, an unsupported source kind, or server API errors while initializing migration state.

Common situations: Typo in database name, config.yaml missing the database entry, CLI/server version mismatch, wrong endpoint or admin secret.

Related errors


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