{"record":{"id":"dbc1c22721e02998","repo":"vitessio/vitess","slug":"usage-vdiff-keyspace-workflow-s-s-uuid","errorCode":null,"errorMessage":"usage: VDiff -- <keyspace>.<workflow> %s [%s|<UUID>]","messagePattern":"usage: VDiff -- <keyspace>\\.<workflow> (.+?) \\[(.+?)\\|<UUID>\\]","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/vdiff2.go","lineNumber":81,"sourceCode":"\tmaxExtraRowsToCompare := subFlags.Int64(\"max_extra_rows_to_compare\", 1000, \"If there are collation differences between the source and target, you can have rows that are identical but simply returned in a different order from MySQL. We will do a second pass to compare the rows for any actual differences in this case and this flag allows you to control the resources used for this operation.\")\n\n\tautoRetry := subFlags.Bool(\"auto-retry\", true, \"Should this vdiff automatically retry and continue in case of recoverable errors\")\n\tchecksum := subFlags.Bool(\"checksum\", false, \"Use row-level checksums to compare, not yet implemented\")\n\tsamplePct := subFlags.Int64(\"sample_pct\", 100, \"How many rows to sample, not yet implemented\")\n\tverbose := subFlags.Bool(\"verbose\", false, \"Show verbose vdiff output in summaries\")\n\twait := subFlags.Bool(\"wait\", false, \"When creating or resuming a vdiff, wait for it to finish before exiting\")\n\twaitUpdateInterval := subFlags.Duration(\"wait-update-interval\", time.Duration(1*time.Minute), \"When waiting on a vdiff to finish, check and display the current status this often\")\n\tupdateTableStats := subFlags.Bool(\"update-table-stats\", false, \"Update the table statistics, using ANALYZE TABLE, on each table involved in the VDiff during initialization. This will ensure that progress estimates are as accurate as possible -- but it does involve locks and can potentially impact query processing on the target keyspace.\")\n\n\tif err := subFlags.Parse(args); err != nil {\n\t\treturn err\n\t}\n\tformat = strings.ToLower(format)\n\n\tvar action vdiff.VDiffAction\n\tvar actionArg string\n\n\tusage := fmt.Errorf(\"usage: VDiff -- <keyspace>.<workflow> %s [%s|<UUID>]\", strings.Join(*(*[]string)(unsafe.Pointer(&vdiff.Actions)), \"|\"), strings.Join(vdiff.ActionArgs, \"|\"))\n\tswitch subFlags.NArg() {\n\tcase 1: // for backward compatibility with vdiff1\n\t\taction = vdiff.CreateAction\n\tcase 2:\n\t\taction = vdiff.VDiffAction(strings.ToLower(subFlags.Arg(1)))\n\t\tif action != vdiff.CreateAction {\n\t\t\treturn usage\n\t\t}\n\tcase 3:\n\t\taction = vdiff.VDiffAction(strings.ToLower(subFlags.Arg(1)))\n\t\tactionArg = strings.ToLower(subFlags.Arg(2))\n\tdefault:\n\t\treturn usage\n\t}\n\tif action == \"\" {\n\t\treturn fmt.Errorf(\"invalid action '%s'; %s\", subFlags.Arg(1), usage)\n\t}\n\tkeyspace, workflowName, err := splitKeyspaceWorkflow(subFlags.Arg(0))","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/vdiff2.go#L63-L99","documentation":"commandVDiff2 parses the VDiff command line and constructs a usage error listing all valid actions and action args. It is returned whenever the argument count after `<keyspace>.<workflow>` is not 1 (legacy vdiff1 form), 2, or 3 — i.e. the VDiff subcommand invocation doesn't match any accepted shape.","triggerScenarios":"Calling `vtctl VDiff -- <keyspace>.<workflow>` with zero extra args, or more than 2 args after the workflow (e.g. an extra stray token), so the switch on subFlags.NArg() falls to default and returns the usage error.","commonSituations":"Copy-pasting vdiff1 syntax; forgetting that the action name is a separate argument (`VDiff ks.wf show` not `VDiff ks.wf show all extra`); shell splitting inserting unexpected tokens; missing the `--` separator so vtctl flags consume arguments.","solutions":["Use `vtctl VDiff -- <keyspace>.<workflow> <action> [<actionArg>|<UUID>]` — 1, 2, or 3 args only after the workflow.","Check the exact action list: create, show, complete, abort, remove, restart, split, delete, etc. (joined with '|' in the usage message).","Ensure `--` separates vtctl-level flags from VDiff args so subFlags receives the intended tokens.","For vdiff1-style invocation, a single extra arg is still accepted (treated as create) — remove extra tokens rather than reformulating."],"exampleFix":"// before\nVDiff -- commerce.sell  show   all status\n// after\nVDiff -- commerce.sell show all","handlingStrategy":"validation","validationCode":"validActions := []string{\"create\",\"show\",\"complete\",\"abort\",\"remove\",\"restart\",\"split\",\"delete\"}\nif len(args) > 3 || (len(args) >= 1 && !slices.Contains(validActions, strings.ToLower(args[0]))) {\n    return fmt.Errorf(\"invalid VDiff invocation; usage: VDiff -- <keyspace>.<workflow> <action> [<actionArg>|<UUID>]\")\n}","typeGuard":null,"tryCatchPattern":"if err := runVDiff(args); err != nil {\n    if strings.Contains(err.Error(), \"usage: VDiff\") {\n        fmt.Fprintln(os.Stderr, err)\n        os.Exit(2)\n    }\n}","preventionTips":["Always separate vtctl flags from VDiff args with `--`.","Keep the arg count to workflow + action + optional qualifier.","Check the action list for your exact Vitess version before scripting."],"tags":["vtctl","vdiff","cli-usage"],"backgroundTag":"invalid-cli-argument","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}