vitessio/vitess · error
invalid tablet type passed %s
Error message
invalid tablet type passed %s
What it means
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.
Source
Thrown at go/vt/wrangler/workflow.go:458
}
return nil
}
func (vrw *VReplicationWorkflow) parseTabletTypes() (hasReplica, hasRdonly, hasPrimary bool, err error) {
tabletTypes, _, err := discovery.ParseTabletTypesAndOrder(vrw.params.TabletTypes)
if err != nil {
return false, false, false, err
}
for _, tabletType := range tabletTypes {
switch tabletType {
case topodatapb.TabletType_REPLICA:
hasReplica = true
case topodatapb.TabletType_RDONLY:
hasRdonly = true
case topodatapb.TabletType_PRIMARY:
hasPrimary = true
default:
return false, false, false, fmt.Errorf("invalid tablet type passed %s", tabletType)
}
}
return hasReplica, hasRdonly, hasPrimary, nil
}
// endregion
// region Core Actions
func (vrw *VReplicationWorkflow) initMoveTables() error {
log.Info(fmt.Sprintf("In VReplicationWorkflow.initMoveTables() for %+v", vrw))
return vrw.wr.MoveTables(vrw.ctx, vrw.params.Workflow, vrw.params.SourceKeyspace, vrw.params.TargetKeyspace,
vrw.params.Tables, vrw.params.Cells, vrw.params.TabletTypes, vrw.params.AllTables, vrw.params.ExcludeTables,
vrw.params.AutoStart, vrw.params.StopAfterCopy, vrw.params.ExternalCluster, vrw.params.DropForeignKeys,
vrw.params.DeferSecondaryKeys, vrw.params.SourceTimeZone, vrw.params.OnDDL, vrw.params.SourceShards,
vrw.params.NoRoutingRules, vrw.params.AtomicCopy)
}
View on GitHub (pinned to 01a25a7d17)
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)
Example fix
// before (tablet left as SPARE) vtctldclient SetWritable ... // fails downstream // after vtctldclient ChangeTabletType <alias> REPLICA then re-run switch traffic
Defensive patterns
Strategy: validation
Validate before calling
for _, tt := range tabletTypes {
switch tt {
case topodatapb.TabletType_REPLICA, topodatapb.TabletType_RDONLY, topodatapb.TabletType_PRIMARY:
default:
return fmt.Errorf("tablet type %s not switchable; retype tablet first", tt)
}
} Type guard
func isSwitchableTabletType(tt topodatapb.TabletType) bool {
switch tt {
case topodatapb.TabletType_REPLICA, topodatapb.TabletType_RDONLY, topodatapb.TabletType_PRIMARY:
return true
}
return false
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- both atomic copy and partial mode cannot be specified for th
- tablet %s type has changed from %s to %s, restarting vstream
- unknown workflow type %d
- cannot switch traffic for workflow %s at this time: %s
- value out of range
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/0056a5e730275672.
Report an issue: GitHub.