{"record":{"id":"74fa033aa013f27f","repo":"vitessio/vitess","slug":"failed-to-parse-workflow-type-column-v","errorCode":null,"errorMessage":"failed to parse workflow_type column: %v","messagePattern":"failed to parse workflow_type column: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/binlog/binlogplayer/binlog_player.go","lineNumber":603,"sourceCode":"\tmaxTPS, err := vrRow.ToInt64(\"max_tps\")\n\tif err != nil {\n\t\treturn VRSettings{}, fmt.Errorf(\"failed to parse max_tps column: %v\", err)\n\t}\n\tmaxReplicationLag, err := vrRow.ToInt64(\"max_replication_lag\")\n\tif err != nil {\n\t\treturn VRSettings{}, fmt.Errorf(\"failed to parse max_replication_lag column: %v\", err)\n\t}\n\tstartPos, err := DecodePosition(vrRow.AsString(\"pos\", \"\"))\n\tif err != nil {\n\t\treturn VRSettings{}, fmt.Errorf(\"failed to parse pos column: %v\", err)\n\t}\n\tstopPos, err := replication.DecodePosition(vrRow.AsString(\"stop_pos\", \"\"))\n\tif err != nil {\n\t\treturn VRSettings{}, fmt.Errorf(\"failed to parse stop_pos column: %v\", err)\n\t}\n\tworkflowType, err := vrRow.ToInt32(\"workflow_type\")\n\tif err != nil {\n\t\treturn VRSettings{}, fmt.Errorf(\"failed to parse workflow_type column: %v\", err)\n\t}\n\tworkflowSubType, err := vrRow.ToInt32(\"workflow_sub_type\")\n\tif err != nil {\n\t\treturn VRSettings{}, fmt.Errorf(\"failed to parse workflow_sub_type column: %v\", err)\n\t}\n\tdeferSecondaryKeys, err := vrRow.ToBool(\"defer_secondary_keys\")\n\tif err != nil {\n\t\treturn VRSettings{}, fmt.Errorf(\"failed to parse defer_secondary_keys column: %v\", err)\n\t}\n\toptions := vrRow.AsString(\"options\", \"{}\")\n\tvar workflowOptions vtctldata.WorkflowOptions\n\tif err := json.Unmarshal([]byte(options), &workflowOptions); err != nil {\n\t\treturn VRSettings{}, fmt.Errorf(\"failed to parse options column: %v\", err)\n\t}\n\treturn VRSettings{\n\t\tStartPos:           startPos,\n\t\tStopPos:            stopPos,\n\t\tMaxTPS:             maxTPS,","sourceCodeStart":585,"sourceCodeEnd":621,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/binlog/binlogplayer/binlog_player.go#L585-L621","documentation":"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.","triggerScenarios":"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.","commonSituations":"Restoring _vt.vreplication from a pre-workflow_type Vitess version; manual inserts omitting the column; corrupted row content.","solutions":["Check: `select uid, workflow_type from _vt.vreplication where uid=<id>`.","Set a valid enum value matching the workflow (via VExec/SQL update, referencing vtctldata.WorkflowType constants).","If the schema is from an older version, run the Vitess schema upgrade for _vt.vreplication before resuming the workflow.","Re-create the workflow if the type cannot be recovered."],"exampleFix":"// before\nupdate _vt.vreplication set workflow_type=NULL where uid=1;\n// after: e.g. MoveTables\nupdate _vt.vreplication set workflow_type=1 where uid=1;","handlingStrategy":"validation","validationCode":"qr, _ := dbClient.ExecuteFetch(fmt.Sprintf(\"SELECT workflow_type FROM _vt.vreplication WHERE uid=%d\", uid), 1)\nif len(qr.Rows) == 1 {\n\tv := qr.Named().Row().AsString(\"workflow_type\", \"\")\n\tn, err := strconv.ParseInt(v, 10, 32)\n\tif err != nil || n < 0 {\n\t\treturn fmt.Errorf(\"workflow_type %q invalid; set a valid WorkflowType enum value\", v)\n\t}\n}","typeGuard":"func isValidWorkflowType(s string) bool {\n\tn, err := strconv.ParseInt(s, 10, 32)\n\treturn err == nil && n >= 0\n}","tryCatchPattern":"settings, err := binlogplayer.ReadVRSettings(dbClient, uid)\nif err != nil && strings.Contains(err.Error(), \"failed to parse workflow_type\") {\n\t// metadata unrecoverable: recreate the workflow\n\treturn recreateWorkflow(ctx, uid)\n}","preventionTips":["Run Vitess schema upgrades for _vt before resuming old workflows.","Use the workflow API (vtctldclient) to manage streams.","Insert integer enum values only; never NULL or text."],"tags":["vreplication","parsing","schema-migration","mysql"],"backgroundTag":"column-parse-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}