vitessio/vitess · error

type %v is not one of: %v

Error message

type %v is not one of: %v

What it means

parseTabletType also validates that the parsed tablet type is among the types allowed for the specific command (the `types` list parameter). This error fires when the type string is valid but not permitted for that operation — e.g. a type that the command refuses to set or list.

Source

Thrown at go/vt/vtctl/vtctl.go:908

	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")
	shard := subFlags.String("shard", "", "The shard to which this tablet belongs")

	var tags flagutil.StringMapValue

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Use a type from the command's allowed list shown in the error message
  2. For master promotion/demotion use `vtctl PlannedReparentShard` instead of ChangeTabletType
  3. Check the command help to see which types are accepted
  4. Adjust the script/config to pass a supported type

Example fix

// before
vtctl ChangeTabletType zone1-0000000100 MASTER
// after
vtctl PlannedReparentShard commerce/0 zone1-0000000100
Defensive patterns

Strategy: validation

Validate before calling

# Check the command's allowed types in help output before running
vtctl ChangeTabletType --help | grep -A2 'tablet type'
# and gate master changes to reparent workflows in your tooling
[[ "$TARGET_TYPE" == "MASTER" ]] && { use_reparent_workflow; exit; }

Try / catch

if err := runVtctl("ChangeTabletType", alias, tt); err != nil {
    if strings.Contains(err.Error(), "is not one of:") {
        // parse allowed list from the message and retry with a permitted type
    }
}

Prevention

When it happens

Trigger: Calling commandInitTablet or commandChangeTabletType with a legitimate tablet type that is outside the command's allowed list — e.g. attempting to change a tablet to MASTER via ChangeTabletType where MASTER is not in the permitted types, or listing with a disallowed filter type.

Common situations: Trying to demote/promote to MASTER with ChangeTabletType instead of the PlannedReparentShard workflow; filtering ListAllTablets by a type the command doesn't accept; scripts written for older Vitess versions where allowed sets differed.

Related errors


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/9a731cfabd98bc95. Report an issue: GitHub.