{"record":{"id":"6a9253b905f8da22","repo":"vitessio/vitess","slug":"unknown-workflow-type-passed-v","errorCode":null,"errorMessage":"unknown workflow type passed: %v","messagePattern":"unknown workflow type passed: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/vtctl.go","lineNumber":2295,"sourceCode":"\t\t\tvrwp.ExcludeTables = *excludes\n\t\t\tvrwp.Timeout = *timeout\n\t\t\tvrwp.ExternalCluster = externalClusterName\n\t\t\tvrwp.SourceTimeZone = *sourceTimeZone\n\t\t\tvrwp.DropForeignKeys = *dropForeignKeys\n\t\t\tvrwp.NoRoutingRules = *noRoutingRules\n\t\t\tif *sourceShards != \"\" {\n\t\t\t\tvrwp.SourceShards = strings.Split(*sourceShards, \",\")\n\t\t\t}\n\t\tcase wrangler.ReshardWorkflow:\n\t\t\tif *sourceShards == \"\" || *targetShards == \"\" {\n\t\t\t\treturn errors.New(\"source and target shards are not specified\")\n\t\t\t}\n\t\t\tvrwp.SourceShards = strings.Split(*sourceShards, \",\")\n\t\t\tvrwp.TargetShards = strings.Split(*targetShards, \",\")\n\t\t\tvrwp.SkipSchemaCopy = *skipSchemaCopy\n\t\t\tvrwp.SourceKeyspace = target\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unknown workflow type passed: %v\", workflowType)\n\t\t}\n\t\tvrwp.OnDDL = onDDL\n\t\tvrwp.DeferSecondaryKeys = *deferNonPKeys\n\t\tvrwp.Cells = *cells\n\t\tvrwp.TabletTypes = *tabletTypesStr\n\tcase vReplicationWorkflowActionSwitchTraffic, vReplicationWorkflowActionReverseTraffic:\n\t\tvrwp.Cells = *cells\n\t\tif subFlags.Changed(\"tablet_types\") {\n\t\t\tvrwp.TabletTypes = *tabletTypesStr\n\t\t} else {\n\t\t\t// When no tablet types are specified we are supposed to switch all traffic so\n\t\t\t// we override the normal default for tablet_types.\n\t\t\tvrwp.TabletTypes = \"in_order:RDONLY,REPLICA,PRIMARY\"\n\t\t}\n\t\tvrwp.Timeout = *timeout\n\t\tvrwp.EnableReverseReplication = *reverseReplication\n\t\tvrwp.MaxAllowedTransactionLagSeconds = int64(math.Ceil(maxReplicationLagAllowed.Seconds()))\n\t\tvrwp.InitializeTargetSequences = *initializeTargetSequences","sourceCodeStart":2277,"sourceCodeEnd":2313,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/vtctl.go#L2277-L2313","documentation":"When building workflow params for the create action, commandVReplicationWorkflow switches on the workflowType (MoveTables, Reshard, or Migrate). If the workflow type doesn't match any known case — meaning commandVReplicationWorkflow was invoked through an unexpected wrapper — this internal error is returned.","triggerScenarios":"Invoking commandVReplicationWorkflow via an anonymous/unknown command binding whose workflowType is not one of the wrangler-defined MoveTables/Reshard/MigrateWorkflow types. Not reachable from normal MoveTables/Reshard/Migrate CLI entry points.","commonSituations":"Custom builds or forks registering a new vtctl command wired to commandVReplicationWorkflow without adding a wrangler workflow type; internal refactors that forget to add the new workflow type to the switch; unit-test harnesses calling the function directly.","solutions":["Add the new workflow type to the switch in commandVReplicationWorkflow and define it in wrangler","Register the vtctl command through the standard commandMoveTables/commandReshard/commandMigrate wrappers","Update any fork/patch that introduced a new workflow type","Pin to an official Vitess release if a custom build is the cause"],"exampleFix":"// before\ndefault:\n    return fmt.Errorf(\"unknown workflow type passed: %v\", workflowType)\n// after\n// register the command via the standard wrapper instead of a custom type\ncommands = append(commands, commandMigrate{dc}) // uses wrangler.MigrateWorkflow\n","handlingStrategy":"type-guard","validationCode":"# Only invoke commandVReplicationWorkflow through its standard wrappers\n# and assert the workflow type is a known wrangler constant:\nif workflowType != wrangler.MoveTablesWorkflow &&\n   workflowType != wrangler.ReshardWorkflow &&\n   workflowType != wrangler.MigrateWorkflow {\n    return fmt.Errorf(\"unsupported workflow type %v\", workflowType)\n}","typeGuard":"func knownWorkflowType(t wrangler.WorkflowType) bool {\n    switch t {\n    case wrangler.MoveTablesWorkflow, wrangler.ReshardWorkflow, wrangler.MigrateWorkflow:\n        return true\n    }\n    return false\n}","tryCatchPattern":"if err := runVtctlWorkflow(action, workflowType, ...); err != nil {\n    if strings.Contains(err.Error(), \"unknown workflow type passed\") {\n        // custom build/fork issue: verify command registration and vitess version\n    }\n}","preventionTips":["Register new vtctl commands only via commandMoveTables/commandReshard/commandMigrate wrappers","When adding a workflow type in wrangler, update the switch in commandVReplicationWorkflow in the same PR","Avoid calling internal vtctl command functions directly from tests/forks","Prefer official Vitess releases over patched builds unless the patch is reviewed"],"tags":["vtctl","vreplication","internal","workflow"],"backgroundTag":"unknown-workflow-type","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}