vitessio/vitess · error
the <tablet alias> argument is required for the SetReadWrite
Error message
the <tablet alias> argument is required for the SetReadWrite command
What it means
This error is returned by the vtctl commandSetReadWrite handler when the SetReadWrite command is invoked without exactly one positional argument. The command expects a single <tablet alias> identifying the tablet to switch between replica (read-write capable after promotion) and read-only service. vtctl's generic dispatcher parses flags but leaves positional-argument validation to each command handler, which enforces the exact count with subFlags.NArg() != 1.
Source
Thrown at go/vt/vtctl/vtctl.go:1080
}
tabletAlias, err := topoproto.ParseTabletAlias(subFlags.Arg(0))
if err != nil {
return err
}
_, err = wr.VtctldServer().SetWritable(ctx, &vtctldatapb.SetWritableRequest{
TabletAlias: tabletAlias,
Writable: false,
})
return err
}
func commandSetReadWrite(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) error {
if err := subFlags.Parse(args); err != nil {
return err
}
if subFlags.NArg() != 1 {
return errors.New("the <tablet alias> argument is required for the SetReadWrite command")
}
tabletAlias, err := topoproto.ParseTabletAlias(subFlags.Arg(0))
if err != nil {
return err
}
_, err = wr.VtctldServer().SetWritable(ctx, &vtctldatapb.SetWritableRequest{
TabletAlias: tabletAlias,
Writable: true,
})
return err
}
func commandStartReplication(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) error {
if err := subFlags.Parse(args); err != nil {
return err
}
if subFlags.NArg() != 1 {View on GitHub (pinned to 01a25a7d17)
Solutions
- Re-run the command with exactly one tablet alias argument, e.g. `vtctl SetReadWrite <cell-0000000100>`.
- If the alias came from a shell variable, verify it is non-empty (`echo "$TABLET_ALIAS"`).
- Quote arguments containing special characters so they count as a single positional arg.
- Check `vtctl SetReadWrite --help` for the expected argument list.
Example fix
// before vtctl SetReadWrite // after vtctl SetReadWrite zone1-0000000100
Defensive patterns
Strategy: validation
Validate before calling
alias="zone1-0000000100" if [ -z "$alias" ] || [ $# -ne 1 ]; then echo "usage: vtctl SetReadWrite <tablet alias>" >&2 exit 2 fi vtctl SetReadWrite "$alias"
Try / catch
if out, err := exec.Command("vtctl", "SetReadWrite", alias).CombinedOutput(); err != nil {
if strings.Contains(string(out), "argument is required for the SetReadWrite") {
// fix argv: pass exactly one alias and retry
}
return fmt.Errorf("SetReadWrite failed: %s: %w", out, err)
} Prevention
- Always pass exactly one tablet alias token to SetReadWrite.
- Quote arguments containing slashes or spaces so they count as one arg.
- Verify shell variables holding the alias are non-empty before invoking.
- Use `vtctl SetReadWrite --help` to confirm the argument list before scripting.
When it happens
Trigger: Running `vtctl SetReadWrite` with zero arguments, or with two or more arguments (e.g. an alias plus an accidental extra token, or an unquoted keyspace/shard that splits). Any NArg() != 1 triggers it.
Common situations: Typing the command without the alias from shell history or documentation; forgetting to quote an argument containing a slash or space so it splits into multiple args; a script variable holding the tablet alias being empty.
Related errors
- action StartReplication requires <tablet alias>
- action StopReplication requires <tablet alias>
- the <tablet alias> and <db type> arguments are required for
- the <tablet alias> argument is required for the Ping command
- the <tablet alias> argument is required for the RefreshState
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/841abed42343755e.
Report an issue: GitHub.