{"record":{"id":"0056a5e730275672","repo":"vitessio/vitess","slug":"invalid-tablet-type-passed-s-0056a5","errorCode":null,"errorMessage":"invalid tablet type passed %s","messagePattern":"invalid tablet type passed (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/wrangler/workflow.go","lineNumber":458,"sourceCode":"\t}\n\treturn nil\n}\n\nfunc (vrw *VReplicationWorkflow) parseTabletTypes() (hasReplica, hasRdonly, hasPrimary bool, err error) {\n\ttabletTypes, _, err := discovery.ParseTabletTypesAndOrder(vrw.params.TabletTypes)\n\tif err != nil {\n\t\treturn false, false, false, err\n\t}\n\tfor _, tabletType := range tabletTypes {\n\t\tswitch tabletType {\n\t\tcase topodatapb.TabletType_REPLICA:\n\t\t\thasReplica = true\n\t\tcase topodatapb.TabletType_RDONLY:\n\t\t\thasRdonly = true\n\t\tcase topodatapb.TabletType_PRIMARY:\n\t\t\thasPrimary = true\n\t\tdefault:\n\t\t\treturn false, false, false, fmt.Errorf(\"invalid tablet type passed %s\", tabletType)\n\t\t}\n\t}\n\treturn hasReplica, hasRdonly, hasPrimary, nil\n}\n\n// endregion\n\n// region Core Actions\n\nfunc (vrw *VReplicationWorkflow) initMoveTables() error {\n\tlog.Info(fmt.Sprintf(\"In VReplicationWorkflow.initMoveTables() for %+v\", vrw))\n\treturn vrw.wr.MoveTables(vrw.ctx, vrw.params.Workflow, vrw.params.SourceKeyspace, vrw.params.TargetKeyspace,\n\t\tvrw.params.Tables, vrw.params.Cells, vrw.params.TabletTypes, vrw.params.AllTables, vrw.params.ExcludeTables,\n\t\tvrw.params.AutoStart, vrw.params.StopAfterCopy, vrw.params.ExternalCluster, vrw.params.DropForeignKeys,\n\t\tvrw.params.DeferSecondaryKeys, vrw.params.SourceTimeZone, vrw.params.OnDDL, vrw.params.SourceShards,\n\t\tvrw.params.NoRoutingRules, vrw.params.AtomicCopy)\n}\n","sourceCodeStart":440,"sourceCodeEnd":476,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/wrangler/workflow.go#L440-L476","documentation":"parseTabletTypes classifies each tablet type relevant to traffic switching (REPLICA, RDONLY, PRIMARY) to decide which serving types can be switched. Any tablet type outside those three reaches the default case and is rejected as invalid input.","triggerScenarios":"parseTabletTypes encounters a topodatapb.TabletType other than REPLICA, RDONLY, or PRIMARY (e.g. SPARE, BACKUP, RESTORE, EXPERIMENTAL) among the tablets involved in the workflow's traffic switch.","commonSituations":"Workflows whose source/target keyspace contains spare or backup tablets; test code (e.g. TestReshardingWorkflowErrorsAndMisc) exercising the invalid-type path; unexpected tablet states left by failed maintenance.","solutions":["Set the tablet to a supported type (REPLICA/RDONLY/PRIMARY) before switching traffic, or exclude it from the workflow's tablet set","Ensure stray non-serving tablets (BACKUP/SPARE) are retyped or drained via vtctld","Confirm with the tablet list which tablet has the offending type (it is printed in the error)"],"exampleFix":"// before (tablet left as SPARE)\nvtctldclient SetWritable ... // fails downstream\n// after\nvtctldclient ChangeTabletType <alias> REPLICA\nthen re-run switch traffic","handlingStrategy":"validation","validationCode":"for _, tt := range tabletTypes {\n    switch tt {\n    case topodatapb.TabletType_REPLICA, topodatapb.TabletType_RDONLY, topodatapb.TabletType_PRIMARY:\n    default:\n        return fmt.Errorf(\"tablet type %s not switchable; retype tablet first\", tt)\n    }\n}","typeGuard":"func isSwitchableTabletType(tt topodatapb.TabletType) bool {\n    switch tt {\n    case topodatapb.TabletType_REPLICA, topodatapb.TabletType_RDONLY, topodatapb.TabletType_PRIMARY:\n        return true\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Audit workflow tablets for SPARE/BACKUP types before traffic switch","Retype or remove non-serving tablets from workflow shard sets","Validate tablet types in preflight checks before SwitchTraffic"],"tags":["vreplication","tablet-type","switch-traffic","invalid-argument"],"backgroundTag":"invalid-enum-value","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}