{"record":{"id":"cb18665147bb79be","repo":"vitessio/vitess","slug":"cluster-type-can-be-only-one-of-vitess-or-mysql","errorCode":null,"errorMessage":"cluster type can be only one of vitess or mysql","messagePattern":"cluster type can be only one of vitess or mysql","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/vtctl.go","lineNumber":3899,"sourceCode":"\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif vci == nil {\n\t\t\t\treturn fmt.Errorf(\"there is no vitess cluster named %s\", clusterName)\n\t\t\t}\n\t\t\tdata, err := json.Marshal(vci)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\twr.Logger().Printf(\"%s\\n\", string(data))\n\t\t\treturn nil\n\t\tdefault:\n\t\t\treturn wr.MountExternalVitessCluster(ctx, clusterName, *topoType, *topoServer, *topoRoot)\n\t\t}\n\tcase \"mysql\":\n\t\treturn errors.New(\"mysql cluster type not yet supported\")\n\tdefault:\n\t\treturn errors.New(\"cluster type can be only one of vitess or mysql\")\n\t}\n}\n\nfunc commandGenerateShardRanges(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) error {\n\tnumShards := subFlags.Int(\"num_shards\", 2, \"Number of shards to generate shard ranges for.\")\n\n\tif err := subFlags.Parse(args); err != nil {\n\t\treturn err\n\t}\n\n\tshardRanges, err := key.GenerateShardRanges(*numShards, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn printJSON(wr.Logger(), shardRanges)\n}\n","sourceCodeStart":3881,"sourceCodeEnd":3917,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/vtctl.go#L3881-L3917","documentation":"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.","triggerScenarios":"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.","commonSituations":"Confusing --topo_type (etcd2, zk2, consul) with the cluster type flag; typos; copy-pasted commands from older docs where flag names differed.","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"],"exampleFix":"// before\nvtctl Mount --type etcd2 ... ext1\n// after\nvtctl Mount --type vitess --topo_type etcd2 ... ext1","handlingStrategy":"validation","validationCode":"if clusterType != \"vitess\" && clusterType != \"mysql\" {\n    return fmt.Errorf(\"invalid cluster type %q: must be vitess or mysql\", clusterType)\n}","typeGuard":"func validClusterType(t string) bool { return t == \"vitess\" || t == \"mysql\" }","tryCatchPattern":"if err := runMount(args); err != nil {\n    if strings.Contains(err.Error(), \"cluster type can be only\") {\n        return fmt.Errorf(\"bad --type flag: %w\", err)\n    }\n    return err\n}","preventionTips":["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"],"tags":["vtctl","cli","invalid-argument"],"backgroundTag":"invalid-argument-value","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}