{"record":{"id":"678e31e5dba5a82a","repo":"vitessio/vitess","slug":"failed-to-parse-workflow-sub-type-column-v","errorCode":null,"errorMessage":"failed to parse workflow_sub_type column: %v","messagePattern":"failed to parse workflow_sub_type column: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/binlog/binlogplayer/binlog_player.go","lineNumber":607,"sourceCode":"\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,\n\t\tMaxReplicationLag:  maxReplicationLag,\n\t\tState:              binlogdatapb.VReplicationWorkflowState(binlogdatapb.VReplicationWorkflowState_value[vrRow.AsString(\"state\", \"\")]),\n\t\tWorkflowType:       binlogdatapb.VReplicationWorkflowType(workflowType),\n\t\tWorkflowName:       vrRow.AsString(\"workflow\", \"\"),","sourceCodeStart":589,"sourceCodeEnd":625,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/binlog/binlogplayer/binlog_player.go#L589-L625","documentation":"Returned by the binlog player when the workflow_sub_type column value from the vreplication metadata row cannot be parsed, wrapping the underlying conversion error.","triggerScenarios":"vrRow.ToInt32(\"workflow_sub_type\") fails: NULL or non-numeric content in the column, schema drift from restores, or manual row writes omitting a valid sub-type.","commonSituations":"Older backups of _vt.vreplication lacking/with different sub-type data; manual inserts; interrupted updates.","solutions":["Check the stored value: `select uid, workflow_sub_type from _vt.vreplication where uid=<id>`.","Set it to a valid vtctldata.WorkflowSubType value (0 = None is safe for simple workflows).","Upgrade/restore the canonical _vt schema if it drifted between Vitess versions.","Re-create the workflow if metadata is unrecoverable."],"exampleFix":"// before\nupdate _vt.vreplication set workflow_sub_type='none' where uid=1;\n// after\nupdate _vt.vreplication set workflow_sub_type=0 where uid=1;","handlingStrategy":"validation","validationCode":"qr, _ := dbClient.ExecuteFetch(fmt.Sprintf(\"SELECT workflow_sub_type FROM _vt.vreplication WHERE uid=%d\", uid), 1)\nif len(qr.Rows) == 1 {\n\tv := qr.Named().Row().AsString(\"workflow_sub_type\", \"\")\n\tif _, err := strconv.ParseInt(v, 10, 32); err != nil {\n\t\treturn fmt.Errorf(\"workflow_sub_type %q invalid; set a valid WorkflowSubType value (0 = None)\", v)\n\t}\n}","typeGuard":"func isValidWorkflowSubType(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_sub_type\") {\n\t_, _ = dbClient.ExecuteFetch(fmt.Sprintf(\"UPDATE _vt.vreplication SET workflow_sub_type=0 WHERE uid=%d\", uid), 0)\n\tsettings, err = binlogplayer.ReadVRSettings(dbClient, uid)\n}","preventionTips":["Default sub-type to 0 (None) when unsure.","Only write enum integers to the column.","Keep _vt data version-aligned with the Vitess binaries."],"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"}