{"record":{"id":"5e57da7ed29d2bf4","repo":"vitessio/vitess","slug":"action-stopreplication-requires-tablet-alias","errorCode":null,"errorMessage":"action StopReplication requires <tablet alias>","messagePattern":"action StopReplication requires <tablet alias>","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/vtctl.go","lineNumber":1118,"sourceCode":"\t}\n\n\ttabletAlias, err := topoproto.ParseTabletAlias(subFlags.Arg(0))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = wr.VtctldServer().StartReplication(ctx, &vtctldatapb.StartReplicationRequest{\n\t\tTabletAlias: tabletAlias,\n\t})\n\treturn err\n}\n\nfunc commandStopReplication(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) error {\n\tif err := subFlags.Parse(args); err != nil {\n\t\treturn err\n\t}\n\tif subFlags.NArg() != 1 {\n\t\treturn errors.New(\"action StopReplication requires <tablet alias>\")\n\t}\n\n\ttabletAlias, err := topoproto.ParseTabletAlias(subFlags.Arg(0))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = wr.VtctldServer().StopReplication(ctx, &vtctldatapb.StopReplicationRequest{\n\t\tTabletAlias: tabletAlias,\n\t})\n\treturn err\n}\n\nfunc commandChangeTabletType(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) error {\n\tdryRun := subFlags.Bool(\"dry-run\", false, \"Lists the proposed change without actually executing it\")\n\n\tif err := subFlags.Parse(args); err != nil {\n\t\treturn err","sourceCodeStart":1100,"sourceCodeEnd":1136,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/vtctl.go#L1100-L1136","documentation":"This error is raised by the vtctl commandStopReplication handler when StopReplication does not receive exactly one positional argument. The command requires a single <tablet alias> to identify the tablet whose replication should be halted. Argument-count validation is done per-command in the handler, so the error fires before any tablet RPC.","triggerScenarios":"Invoking `vtctl StopReplication` with zero or with multiple positional arguments (NArg() != 1).","commonSituations":"Empty alias variable in automation scripts; accidentally including flags-like extra tokens after the alias; forgetting the alias when manually halting replication during maintenance.","solutions":["Re-run with exactly one alias: `vtctl StopReplication zone1-0000000101`.","Ensure no stray tokens follow the alias (flags must come before positional args or be properly formed).","Check the alias variable is populated in scripts before invoking vtctl.","Run `vtctl StopReplication --help` to confirm usage."],"exampleFix":"// before\nvtctl StopReplication\n// after\nvtctl StopReplication zone1-0000000101","handlingStrategy":"validation","validationCode":"alias=\"zone1-0000000101\"\nif [ -z \"$alias\" ] || [ $# -ne 1 ]; then\n  echo \"usage: vtctl StopReplication <tablet alias>\" >&2\n  exit 2\nfi\nvtctl StopReplication \"$alias\"","typeGuard":null,"tryCatchPattern":"out, err := exec.Command(\"vtctl\", \"StopReplication\", alias).CombinedOutput()\nif err != nil {\n    if strings.Contains(string(out), \"requires <tablet alias>\") {\n        // inspect argv and retry with exactly one alias\n    }\n    return err\n}","preventionTips":["Supply exactly one tablet alias as the sole positional argument.","Avoid stray tokens after the alias; put flags before positionals.","Sanity-check alias variables in scripts.","Confirm usage with --help when unsure."],"tags":["vtctl","cli","missing-argument","replication"],"backgroundTag":"missing-required-cli-argument","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}