{"record":{"id":"795a27271ba0f4c3","repo":"vitessio/vitess","slug":"workflow-s-does-not-exist","errorCode":null,"errorMessage":"workflow %s does not exist","messagePattern":"workflow (.+?) does not exist","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/vtctl.go","lineNumber":2337,"sourceCode":"\t\tcase wrangler.MoveTablesWorkflow:\n\t\t\tvrwp.RenameTables = *renameTables\n\t\tcase wrangler.ReshardWorkflow:\n\t\tcase wrangler.MigrateWorkflow:\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unknown workflow type passed: %v\", workflowType)\n\t\t}\n\t\tvrwp.KeepData = *keepData\n\t\tvrwp.KeepRoutingRules = *keepRoutingRules\n\t}\n\tvrwp.WorkflowType = workflowType\n\tvrwp.ShardSubset = *shards\n\twf, err := wr.NewVReplicationWorkflow(ctx, workflowType, vrwp)\n\tif err != nil {\n\t\tlog.Warn(fmt.Sprintf(\"NewVReplicationWorkflow returned error %+v\", wf))\n\t\treturn err\n\t}\n\tif !wf.Exists() && action != vReplicationWorkflowActionCreate {\n\t\treturn fmt.Errorf(\"workflow %s does not exist\", ksWorkflow)\n\t}\n\n\tif len(vrwp.ShardSubset) > 0 {\n\t\tif workflowType == wrangler.MoveTablesWorkflow && action != vReplicationWorkflowActionCreate && wf.IsPartialMigration() {\n\t\t\tlog.Info(fmt.Sprintf(\"Subset of shards: %s have been specified for keyspace %s, workflow %s, for action %s\", vrwp.ShardSubset, target, workflowName, action))\n\t\t} else {\n\t\t\treturn errors.New(\"The --shards option can only be specified for existing Partial MoveTables workflows\")\n\t\t}\n\t}\n\n\tprintCopyProgress := func() error {\n\t\tcopyProgress, err := wf.GetCopyProgress()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif copyProgress != nil {\n\t\t\twr.Logger().Printf(\"\\nCopy Progress (approx):\\n\")\n\t\t\tvar tables []string","sourceCodeStart":2319,"sourceCodeEnd":2355,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/vtctl.go#L2319-L2355","documentation":"Before executing a vreplication workflow action, the code builds a VReplicationWorkflow object and checks wf.Exists(). If the workflow does not exist in the target keyspace and the requested action is anything other than 'create', the command fails. This guards actions like SwitchTraffic, Complete, or Cancel against operating on a nonexistent workflow.","triggerScenarios":"Running e.g. `vtctldclient Reshard complete ks.reshard` when no reshard workflow named `reshard` exists in keyspace `ks`; mistyping the workflow name; the workflow was already fully removed (completed and garbage-collected) in a prior invocation; targeting the wrong keyspace.","commonSituations":"Re-running a Complete/Cancel step after it already succeeded and cleaned up; wrong keyspace.workflow string; workflow name case mismatch; reshard was never started.","solutions":["List existing workflows with `vtctldclient workflow --keyspace <ks> list` to confirm the exact name and keyspace","Correct the <keyspace.workflow> argument spelling/case","If the workflow already completed, no further action is needed — skip the command","Use `create` action first if you intended to start the workflow"],"exampleFix":"// before\nvtctldclient Reshard complete commerce.reshard01  # workflow never created\n// after\nvtctldclient Reshard create --targetks commerce --tablesc.customer,commerce.corder ...","handlingStrategy":"validation","validationCode":"workflows, err := vtctldclient workflow --keyspace commerce list\n// confirm the target workflow name exists before running the action","typeGuard":"func keyspaceWorkflowArg(ks, wf string) string {\n  if ks == \"\" || wf == \"\" || strings.ContainsAny(wf, \".\") { return \"\" }\n  return ks + \".\" + wf\n}","tryCatchPattern":"out, err := runVtctldclient(args...)\nif err != nil && strings.Contains(out, \"does not exist\") {\n  // verify workflow name/keyspace, or treat as already-cleaned-up\n}","preventionTips":["List workflows before acting on them","Record workflow names consistently after create","Remember Complete/Cancel are often one-shot — don't re-run"],"tags":["vreplication","workflow","vtctl"],"backgroundTag":"workflow-not-found","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}