{"record":{"id":"f7decc9c60780e1a","repo":"vitessio/vitess","slug":"invalid-action-s-s","errorCode":null,"errorMessage":"invalid action '%s'; %s","messagePattern":"invalid action '(.+?)'; (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/vdiff2.go","lineNumber":97,"sourceCode":"\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))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif *maxRows <= 0 {\n\t\treturn fmt.Errorf(\"invalid --limit value (%d), maximum number of rows to compare needs to be greater than 0\", *maxRows)\n\t}\n\n\toptions := &tabletmanagerdatapb.VDiffOptions{\n\t\tPickerOptions: &tabletmanagerdatapb.VDiffPickerOptions{\n\t\t\tTabletTypes: *tabletTypes,\n\t\t\tSourceCell:  *sourceCell,\n\t\t\tTargetCell:  *targetCell,\n\t\t},\n\t\tCoreOptions: &tabletmanagerdatapb.VDiffCoreOptions{\n\t\t\tTables:                *tables,","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/vdiff2.go#L79-L115","documentation":"After parsing, VDiff2 converts the second CLI token to a vdiff.VDiffAction. If the token is empty or unrecognized, or the arg count doesn't match any accepted shape, the command returns 'invalid action ...' plus the usage text. This guards against typos and unsupported actions.","triggerScenarios":"`VDiff -- ks.wf <bogus>` where the second argument lowercased is not one of the defined actions (create, show, complete, abort, remove, etc.), or NArg() is 1 with an empty action and the caller intended a real action.","commonSituations":"Typo'd action names (`vdif` instead of `vdiff` verbs like `stopwatches`); using an action from a newer Vitess version on an older binary; passing an action arg in the action slot (e.g. `VDiff ks.wf all` instead of `VDiff ks.wf show all`).","solutions":["Run the command with a clearly invalid extra token to print usage, or read the usage string listing valid actions joined with '|'.","Fix the action spelling (case-insensitive; it is lowercased before the check).","If the action exists in a newer Vitess release, upgrade the vtctl binary or use the actions supported by your version.","Put the qualifier (all|last|UUID) in the third position: `VDiff ks.wf show all`."],"exampleFix":"// before\nVDiff -- commerce.sell delet 1234   # typo\n// after\nVDiff -- commerce.sell delete 1234","handlingStrategy":"validation","validationCode":"actions := map[vdiff.VDiffAction]bool{\"create\":true,\"show\":true,\"complete\":true,\"abort\":true,\"remove\":true}\na := vdiff.VDiffAction(strings.ToLower(actionToken))\nif !actions[a] { return fmt.Errorf(\"unsupported VDiff action %q\", actionToken) }","typeGuard":"func isVDiffAction(s string) bool {\n    switch vdiff.VDiffAction(strings.ToLower(s)) {\n    case vdiff.CreateAction, vdiff.ShowAction, vdiff.CompleteAction, vdiff.AbortAction:\n        return true\n    }\n    return false\n}","tryCatchPattern":"if err := runVDiff(args); err != nil {\n    if strings.Contains(err.Error(), \"invalid action\") {\n        log.Warn(\"typo in VDiff action; see usage in error message\")\n    }\n}","preventionTips":["Copy action names from the usage string rather than typing from memory.","Remember the action is case-insensitive (lowercased) but must be exact otherwise.","Place qualifiers (all/last/UUID) in the third argument position, not the action slot."],"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"}