vitessio/vitess · error
cluster type can be only one of vitess or mysql
Error message
cluster type can be only one of vitess or mysql
What it means
This is the default-case error of the cluster-type switch in the vtctl Mount command. It fires when the supplied cluster type is neither "vitess" nor "mysql", telling the user the type argument must be exactly one of those two values.
Source
Thrown at go/vt/vtctl/vtctl.go:3899
if err != nil {
return err
}
if vci == nil {
return fmt.Errorf("there is no vitess cluster named %s", clusterName)
}
data, err := json.Marshal(vci)
if err != nil {
return err
}
wr.Logger().Printf("%s\n", string(data))
return nil
default:
return wr.MountExternalVitessCluster(ctx, clusterName, *topoType, *topoServer, *topoRoot)
}
case "mysql":
return errors.New("mysql cluster type not yet supported")
default:
return errors.New("cluster type can be only one of vitess or mysql")
}
}
func commandGenerateShardRanges(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) error {
numShards := subFlags.Int("num_shards", 2, "Number of shards to generate shard ranges for.")
if err := subFlags.Parse(args); err != nil {
return err
}
shardRanges, err := key.GenerateShardRanges(*numShards, 0)
if err != nil {
return err
}
return printJSON(wr.Logger(), shardRanges)
}
View on GitHub (pinned to 01a25a7d17)
Solutions
- Set the cluster type flag to exactly "vitess" (or "mysql" if your version supports it)
- Do not pass --topo_type values (etcd2/zk2/consul) as the cluster type; they are separate flags
- Run `vtctl Mount --help` to confirm flag names and allowed values
Example fix
// before vtctl Mount --type etcd2 ... ext1 // after vtctl Mount --type vitess --topo_type etcd2 ... ext1
Defensive patterns
Strategy: validation
Validate before calling
if clusterType != "vitess" && clusterType != "mysql" {
return fmt.Errorf("invalid cluster type %q: must be vitess or mysql", clusterType)
} Type guard
func validClusterType(t string) bool { return t == "vitess" || t == "mysql" } Try / catch
if err := runMount(args); err != nil {
if strings.Contains(err.Error(), "cluster type can be only") {
return fmt.Errorf("bad --type flag: %w", err)
}
return err
} Prevention
- Don't confuse --topo_type (etcd2/zk2/consul) with the cluster type flag
- Use shell completion or flag help to avoid typos
- Store canonical command templates in runbooks instead of retyping flags
When it happens
Trigger: Running `vtctl Mount` with a --type (cluster type) value not present in the switch, e.g. a typo like "vitesss", "etcd" (topo type confused with cluster type), or an empty value.
Common situations: Confusing --topo_type (etcd2, zk2, consul) with the cluster type flag; typos; copy-pasted commands from older docs where flag names differed.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- the <tablet alias> argument is required for the SetReadWrite
- 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
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/cb18665147bb79be.
Report an issue: GitHub.