{"record":{"id":"604380fc4d284330","repo":"vitessio/vitess","slug":"action-reparenttablet-requires-tablet-alias","errorCode":null,"errorMessage":"action ReparentTablet requires <tablet alias>","messagePattern":"action ReparentTablet requires <tablet alias>","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/reparent.go","lineNumber":79,"sourceCode":"\taddCommand(\"Shards\", command{\n\t\tname:   \"TabletExternallyReparented\",\n\t\tmethod: commandTabletExternallyReparented,\n\t\tparams: \"<tablet alias>\",\n\t\thelp: \"Changes metadata in the topology server to acknowledge a shard primary change performed by an external tool. See the Reparenting guide for more information:\" +\n\t\t\t\"https://vitess.io/docs/user-guides/reparenting/#external-reparenting\",\n\t})\n}\n\nfunc commandReparentTablet(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) error {\n\tif mysqlctl.DisableActiveReparents {\n\t\treturn errors.New(\"active reparent commands disabled (unset the --disable-active-reparents flag to enable)\")\n\t}\n\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 ReparentTablet requires <tablet alias>\")\n\t}\n\ttabletAlias, err := topoproto.ParseTabletAlias(subFlags.Arg(0))\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn wr.ReparentTablet(ctx, tabletAlias)\n}\n\nfunc commandInitShardPrimary(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) error {\n\tif mysqlctl.DisableActiveReparents {\n\t\treturn errors.New(\"active reparent commands disabled (unset the --disable-active-reparents flag to enable)\")\n\t}\n\n\tforce := subFlags.Bool(\"force\", false, \"will force the reparent even if the provided tablet is not writable or the shard primary\")\n\twaitReplicasTimeout := subFlags.Duration(\"wait_replicas_timeout\", topo.RemoteOperationTimeout, \"time to wait for replicas to catch up in reparenting\")\n\tif err := subFlags.Parse(args); err != nil {\n\t\treturn err\n\t}","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/reparent.go#L61-L97","documentation":"commandReparentTablet enforces exactly one positional argument: the tablet alias to reparent to the primary role. Any other argument count (zero or multiple) is rejected with this usage error before any parsing or RPC happens.","triggerScenarios":"Running `vtctldclient ReparentTablet` with no arguments, with more than one alias, or with the keyspace/shard mistakenly included as an extra positional arg.","commonSituations":"Copy-pasting command lines from PlannedReparentShard docs (which use keyspace/shard form); shell variable expansions producing empty or extra arguments.","solutions":["Invoke with exactly one argument: `vtctldclient ReparentTablet <tablet-alias>` (e.g. zone1-0000000100)","If you meant to choose a new primary among candidates, use PlannedReparentShard with keyspace/shard and --new_primary instead","Quote or validate shell variables so an empty alias does not collapse the argument count"],"exampleFix":"// before\nvtctldclient ReparentTablet commerce/0 zone1-0000000100\n// after\nvtctldclient ReparentTablet zone1-0000000100","handlingStrategy":"validation","validationCode":"args=(\"$@\"); if [ ${#args[@]} -ne 1 ]; then\n  echo \"usage: vtctldclient ReparentTablet <tablet-alias>\" >&2; exit 2\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass exactly one tablet alias; use PlannedReparentShard for shard-level choice","Quote shell variables to prevent empty or split arguments","Keep a canonical command list per operation to avoid cross-command confusion"],"tags":["reparenting","cli","argument-validation","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"}