vitessio/vitess · error

invalid action for Migrate: %s

Error message

invalid action for Migrate: %s

What it means

For Migrate workflows, commandVReplicationWorkflow only permits the actions create, cancel, and complete (compared after lowercasing). Any other action string returns this error naming the action. MoveTables and Reshard have their own larger action sets, so this restriction is Migrate-specific.

Source

Thrown at go/vt/vtctl/vtctl.go:2222

	wrapError := func(wf *wrangler.VReplicationWorkflow, err error) error {
		wr.Logger().Errorf("\n%s\n", err.Error())
		log.Info(fmt.Sprintf("In wrapError wf is %+v", wf))
		wr.Logger().Infof("Workflow Status: %s\n", wf.CurrentState())
		if wf.Exists() {
			printDetails()
		}
		return err
	}

	// TODO: check if invalid parameters were passed in that do not apply to this action
	originalAction := action
	action = strings.ToLower(action) // allow users to input action in a case-insensitive manner
	if workflowType == wrangler.MigrateWorkflow {
		switch action {
		case vReplicationWorkflowActionCreate, vReplicationWorkflowActionCancel, vReplicationWorkflowActionComplete:
		default:
			return fmt.Errorf("invalid action for Migrate: %s", action)
		}
	}

	switch action {
	case vReplicationWorkflowActionCreate:
		switch workflowType {
		case wrangler.MoveTablesWorkflow, wrangler.MigrateWorkflow:
			var sourceTopo *topo.Server
			var externalClusterName string

			sourceTopo = wr.TopoServer()
			if *sourceKeyspace == "" {
				return errors.New("source keyspace is not specified")
			}
			if workflowType == wrangler.MigrateWorkflow {
				externalClusterName, *sourceKeyspace, err = getSourceKeyspace(*sourceKeyspace)
				if err != nil {
					return err

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Use only create, cancel, or complete with the Migrate command
  2. If you intended traffic switching or monitoring, use MoveTables or Reshard instead
  3. Review the Migrate command help for its supported actions
  4. Fix automation scripts that apply the MoveTables action list to Migrate

Example fix

// before
vtctl Migrate commerce.switchtraffic keyspace
// after
vtctl Migrate cancel customer.commerce   # or use MoveTables for switchtraffic
Defensive patterns

Strategy: validation

Validate before calling

migrate_valid_action() {
  case "$(echo "$1" | tr '[:upper:]' '[:lower:]')" in
    create|cancel|complete) return 0 ;;
    *) echo "Migrate supports only create|cancel|complete, got: $1"; return 1 ;;
  esac
}
migrate_valid_action "$ACTION" || exit 1

Try / catch

if err := runVtctl("Migrate", action, ...); err != nil {
    if strings.Contains(err.Error(), "invalid action for Migrate") {
        // redirect to MoveTables/Reshard if the action requires traffic management
    }
}

Prevention

When it happens

Trigger: Running `vtctl Migrate <action> ...` with an action like 'switchtraffic', 'reversetraffic', 'show', or 'validatedata' — actions that exist for MoveTables/Reshard but are meaningless for Migrate.

Common situations: Copy-pasting a MoveTables runbook and swapping the command name to Migrate; automation that iterates a generic action list; assuming Migrate supports traffic switching (it doesn't — traffic was never switched to the external source).

Related errors


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/458b238e1fde74be. Report an issue: GitHub.