vitessio/vitess · error

failed to parse workflow_type column: %v

Error message

failed to parse workflow_type column: %v

What it means

The workflow_type column (a smallint enum of vreplication workflow kinds, e.g. MoveTables/Reshard) failed conversion to int32. The value stored cannot be interpreted, so the settings struct cannot be populated.

Source

Thrown at go/vt/binlog/binlogplayer/binlog_player.go:603

	maxTPS, err := vrRow.ToInt64("max_tps")
	if err != nil {
		return VRSettings{}, fmt.Errorf("failed to parse max_tps column: %v", err)
	}
	maxReplicationLag, err := vrRow.ToInt64("max_replication_lag")
	if err != nil {
		return VRSettings{}, fmt.Errorf("failed to parse max_replication_lag column: %v", err)
	}
	startPos, err := DecodePosition(vrRow.AsString("pos", ""))
	if err != nil {
		return VRSettings{}, fmt.Errorf("failed to parse pos column: %v", err)
	}
	stopPos, err := replication.DecodePosition(vrRow.AsString("stop_pos", ""))
	if err != nil {
		return VRSettings{}, fmt.Errorf("failed to parse stop_pos column: %v", err)
	}
	workflowType, err := vrRow.ToInt32("workflow_type")
	if err != nil {
		return VRSettings{}, fmt.Errorf("failed to parse workflow_type column: %v", err)
	}
	workflowSubType, err := vrRow.ToInt32("workflow_sub_type")
	if err != nil {
		return VRSettings{}, fmt.Errorf("failed to parse workflow_sub_type column: %v", err)
	}
	deferSecondaryKeys, err := vrRow.ToBool("defer_secondary_keys")
	if err != nil {
		return VRSettings{}, fmt.Errorf("failed to parse defer_secondary_keys column: %v", err)
	}
	options := vrRow.AsString("options", "{}")
	var workflowOptions vtctldata.WorkflowOptions
	if err := json.Unmarshal([]byte(options), &workflowOptions); err != nil {
		return VRSettings{}, fmt.Errorf("failed to parse options column: %v", err)
	}
	return VRSettings{
		StartPos:           startPos,
		StopPos:            stopPos,
		MaxTPS:             maxTPS,

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Check: `select uid, workflow_type from _vt.vreplication where uid=<id>`.
  2. Set a valid enum value matching the workflow (via VExec/SQL update, referencing vtctldata.WorkflowType constants).
  3. If the schema is from an older version, run the Vitess schema upgrade for _vt.vreplication before resuming the workflow.
  4. Re-create the workflow if the type cannot be recovered.

Example fix

// before
update _vt.vreplication set workflow_type=NULL where uid=1;
// after: e.g. MoveTables
update _vt.vreplication set workflow_type=1 where uid=1;
Defensive patterns

Strategy: validation

Validate before calling

qr, _ := dbClient.ExecuteFetch(fmt.Sprintf("SELECT workflow_type FROM _vt.vreplication WHERE uid=%d", uid), 1)
if len(qr.Rows) == 1 {
	v := qr.Named().Row().AsString("workflow_type", "")
	n, err := strconv.ParseInt(v, 10, 32)
	if err != nil || n < 0 {
		return fmt.Errorf("workflow_type %q invalid; set a valid WorkflowType enum value", v)
	}
}

Type guard

func isValidWorkflowType(s string) bool {
	n, err := strconv.ParseInt(s, 10, 32)
	return err == nil && n >= 0
}

Try / catch

settings, err := binlogplayer.ReadVRSettings(dbClient, uid)
if err != nil && strings.Contains(err.Error(), "failed to parse workflow_type") {
	// metadata unrecoverable: recreate the workflow
	return recreateWorkflow(ctx, uid)
}

Prevention

When it happens

Trigger: vrRow.ToInt32("workflow_type") fails: NULL or non-numeric content in workflow_type, or the row predates the column's introduction / was restored from an older schema where the value differs.

Common situations: Restoring _vt.vreplication from a pre-workflow_type Vitess version; manual inserts omitting the column; corrupted row content.

Understand the failure class

Related errors


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