hasura/graphql-engine · error

error validating flags: %w

Error message

error validating flags: %w

What it means

`hasura migrate apply` (Exec) validates its flags via migrate.ValidateUpgradeToV3Flags-ish checks (version, migration type, goto-version, skip-execution combos). Invalid combinations are wrapped in this message.

Source

Thrown at cli/commands/migrate_apply.go:433

				},
			)
		}
	}

	if o.EC.AllDatabases && (len(o.GotoVersion) > 0 || len(o.VersionMigration) > 0) {
		return herrors.E(op, "cannot use --goto or --version in conjunction with --all-databases")
	}

	migrationType, step, err := getMigrationTypeAndStep(
		o.UpMigration,
		o.DownMigration,
		o.VersionMigration,
		o.MigrationType,
		o.GotoVersion,
		o.SkipExecution,
	)
	if err != nil {
		return herrors.E(op, fmt.Errorf("error validating flags: %w", err))
	}

	migrateDrv, err := migrate.NewMigrate(o.EC, true, o.Source.Name, o.Source.Kind)
	if err != nil {
		return herrors.E(op, err)
	}

	migrateDrv.SkipExecution = o.SkipExecution
	migrateDrv.DryRun = o.DryRun
	migrateDrv.ProgressBarLogs = o.ProgressBarLogs
	migrateDrv.NoTransaction = o.NoTransaction
	migrateDrv.PerMigrationTransaction = o.PerMigrationTransaction

	if err := ExecuteMigration(migrationType, migrateDrv, step); err != nil {
		return herrors.E(op, err)
	}

	return nil

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Run `hasura migrate apply --help` and check flag constraints for your CLI version
  2. Use either --version N or --goto-version N, not both
  3. Omit --skip-execution unless doing a version-chain-only update
  4. Update scripts to the current flag semantics after CLI upgrades

Example fix

# before
hasura migrate apply --version 2 --goto-version 5 --version-type up
# after
hasura migrate apply --goto-version 5 --version-type up
Defensive patterns

Strategy: validation

Validate before calling

if [ -n "$VERSION" ] && [ -n "$GOTO" ]; then echo "use only one of --version/--goto-version"; exit 1; fi

Prevention

When it happens

Trigger: Passing conflicting flags such as --version together with --goto-version, invalid --version-type, or --skip-execution with unsupported modes.

Common situations: Scripts combining flags copied from different CLI versions; using --goto-version without a valid up|down|version type.

Related errors


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