vitessio/vitess · error
no sharded vschema was provided, so you will need to update
Error message
no sharded vschema was provided, so you will need to update the vschema of the target manually for the moved tables
What it means
When updating the target keyspace's vschema after a traffic switch, the code can only merge the moved tables' entries if a source (sharded) vschema was provided. If no vschema was supplied but the target vschema is sharded, the tables cannot be safely registered, so it returns this error telling the user to update the target vschema manually.
Source
Thrown at go/vt/vtctl/workflow/traffic_switcher.go:412
if err != nil {
return err
}
if vschema == nil {
return fmt.Errorf("no vschema found for keyspace %s", keyspace)
}
if vschema.Tables == nil {
vschema.Tables = make(map[string]*vschemapb.Table)
}
if strings.HasPrefix(tableSpecs, "{") { // user defined the vschema snippet, typically for a sharded target
wrap := fmt.Sprintf(`{"tables": %s}`, tableSpecs)
ks := &vschemapb.Keyspace{}
if err := json2.UnmarshalPB([]byte(wrap), ks); err != nil {
return err
}
maps.Copy(vschema.Tables, ks.Tables)
} else {
if vschema.Sharded {
return errors.New("no sharded vschema was provided, so you will need to update the vschema of the target manually for the moved tables")
}
for _, table := range ts.tables {
vschema.Tables[table] = &vschemapb.Table{}
}
}
return ts.TopoServer().SaveVSchema(ctx, vschema)
}
func (ts *trafficSwitcher) deleteRoutingRules(ctx context.Context) error {
rules, err := topotools.GetRoutingRules(ctx, ts.TopoServer())
if err != nil {
return err
}
for _, table := range ts.Tables() {
delete(rules, table)
delete(rules, table+"@replica")
delete(rules, table+"@rdonly")
delete(rules, ts.TargetKeyspaceName()+"."+table)View on GitHub (pinned to 01a25a7d17)
Solutions
- Manually add the moved tables' vindex definitions to the target keyspace vschema (`vtctldclient ApplyVSchema`).
- Ensure the source keyspace has a valid sharded vschema in the topo before switching traffic so the tool can copy it.
- If the target should be unsharded, correct the target vschema's sharded flag before the cutover.
Example fix
// before
topo save vschema customer: {"sharded": true} // no tables -> error during switch
// after
vtctldclient ApplyVSchema --vschema '{"sharded":true,"tables":{"sales":{"column_vindexes":[...],"columns":[]}}}' customer Defensive patterns
Strategy: validation
Validate before calling
vs, err := ts.TopoServer().GetVSchema(ctx, targetKeyspace)
if err != nil { return err }
if vs.Sharded && sourceVSchema == nil {
return errors.New("apply the target vschema manually: no sharded source vschema provided")
} Try / catch
if err := switchTraffic(ctx, ks, wf); err != nil {
if strings.Contains(err.Error(), "no sharded vschema was provided") {
// apply target vschema manually, then retry the switch
}
return err
} Prevention
- Ensure the source keyspace has a valid sharded vschema before MoveTables
- Pre-apply the target vschema for sharded targets
- Test vschema copying in a staging cluster before production cutover
When it happens
Trigger: Calling the SwitchReads/SwitchWrites path (vindex copying code in traffic_switcher.go around line 412) during a MoveTables cutover where the target vschema has Sharded=true and no source vschema document was fetched/provided.
Common situations: Target keyspace uses sharded vindexes but the operator never set up the source vschema context, or a cross-keyspace move where the tool cannot fetch the sharded source vschema (e.g. topoSrv vschema missing).
Related errors
- a conflicting vindex named %s already exists in the source v
- source table %s not found in vschema
- ColumnVindex for table %v already exists: %v, please remove
- a conflicting vindex named %v already exists in the target v
- a conflicting table named %v already exists in the target vs
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/de536b684701ebb8.
Report an issue: GitHub.