vitessio/vitess · error
invalid tablet type %v: %v
Error message
invalid tablet type %v: %v
What it means
parseTabletType converts a string CLI argument into a topodatapb.TabletType and validates it is a parseable type name. This error is returned when topoproto.ParseTabletType cannot recognize the string, meaning the user supplied a value that is not a valid Vitess tablet type.
Source
Thrown at go/vt/vtctl/vtctl.go:905
// to tablet aliases.
func tabletParamsToTabletAliases(params []string) ([]*topodatapb.TabletAlias, error) {
result := make([]*topodatapb.TabletAlias, len(params))
var err error
for i, param := range params {
result[i], err = topoproto.ParseTabletAlias(param)
if err != nil {
return nil, err
}
}
return result, nil
}
// parseTabletType parses the string tablet type and verifies
// it is an accepted one
func parseTabletType(param string, types []topodatapb.TabletType) (topodatapb.TabletType, error) {
tabletType, err := topoproto.ParseTabletType(param)
if err != nil {
return topodatapb.TabletType_UNKNOWN, fmt.Errorf("invalid tablet type %v: %v", param, err)
}
if !topoproto.IsTypeInList(topodatapb.TabletType(tabletType), types) {
return topodatapb.TabletType_UNKNOWN, fmt.Errorf("type %v is not one of: %v", tabletType, strings.Join(topoproto.MakeStringTypeList(types), " "))
}
return tabletType, nil
}
func commandInitTablet(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) error {
dbNameOverride := subFlags.String("db_name_override", "", "Overrides the name of the database that the vttablet uses")
allowUpdate := subFlags.Bool("allow_update", false, "Use this flag to force initialization if a tablet with the same name already exists. Use with caution.")
allowPrimaryOverride := subFlags.Bool("allow_master_override", false, "Use this flag to force initialization if a tablet is created as primary, and a primary for the keyspace/shard already exists. Use with caution.")
createShardAndKeyspace := subFlags.Bool("parent", false, "Creates the parent shard and keyspace if they don't yet exist")
hostname := subFlags.String("hostname", "", "The server on which the tablet is running")
mysqlHost := subFlags.String("mysql_host", "", "The mysql host for the mysql server")
mysqlPort := subFlags.Int("mysql-port", 0, "The mysql port for the mysql server")
port := subFlags.Int("port", 0, "The main port for the vttablet process")
grpcPort := subFlags.Int("grpc-port", 0, "The gRPC port for the vttablet process")
keyspace := subFlags.String("keyspace", "", "The keyspace to which this tablet belongs")View on GitHub (pinned to 01a25a7d17)
Solutions
- Use one of the valid type strings: MASTER, REPLICA, RDONLY, SPARE, BACKUP, RESTORE, DRAINED, etc.
- Check spelling and casing against `vtctl ChangeTabletType --help`
- Remove stray whitespace/special characters from the argument
- For older tooling, replace deprecated terms (e.g. 'slave') with current names (REPLICA)
Example fix
// before vtctl ChangeTabletType zone1-0000000100 REPLCA // after vtctl ChangeTabletType zone1-0000000100 REPLICA
Defensive patterns
Strategy: validation
Validate before calling
VALID_TYPES="MASTER REPLICA RDONLY SPARE BACKUP RESTORE DRAINED EXPERIMENTAL"
validate_tablet_type() {
case "$1" in
$VALID_TYPES) return 0 ;;
*) echo "invalid tablet type: $1"; return 1 ;;
esac
}
validate_tablet_type "$TYPE" || exit 1 Try / catch
if err := runVtctl("ChangeTabletType", alias, tt); err != nil {
if strings.Contains(err.Error(), "invalid tablet type") {
// surface the accepted type list to the operator
}
} Prevention
- Validate tablet type strings against the enum in scripts before invoking vtctl
- Use constants, not inline strings, for tablet types in automation
- Strip whitespace from CLI inputs
- Keep scripts updated with current type names (REPLICA, not SLAVE)
When it happens
Trigger: Passing a misspelled or unknown type string to commandInitTablet, commandChangeTabletType, or commandListAllTablets, e.g. `vtctl ChangeTabletType alias REPLCA` — ParseTabletType fails and this wraps that error.
Common situations: Typos in type names (REPLICA, RDONLY); using MySQL-ish terms like 'slave' in versions where only REPLICA is accepted; extra whitespace or wrong casing.
Related errors
- type %v is not one of: %v
- the <tablet alias> and <db type> arguments are required for
- invalid type transition %v: %v -> %v
- invalid value for on-ddl: %v
- invalid action for Migrate: %s
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/d7e70589448d0bc8.
Report an issue: GitHub.