vitessio/vitess · error
GetMirrorRules failed: %v
Error message
GetMirrorRules failed: %v
What it means
RebuildSrvVSchema also merges mirror rules into the SrvVSchema. This error wraps a failure from GetMirrorRules reading the MirrorRules object from the topo, aborting the rebuild before the per-cell save step.
Source
Thrown at go/vt/topo/srv_vschema.go:218
return fmt.Errorf("GetRoutingRules failed: %v", err)
}
srvVSchema.RoutingRules = rr
srr, err := ts.GetShardRoutingRules(ctx)
if err != nil {
return fmt.Errorf("GetShardRoutingRules failed: %v", err)
}
srvVSchema.ShardRoutingRules = srr
krr, err := ts.GetKeyspaceRoutingRules(ctx)
if err != nil {
return fmt.Errorf("GetKeyspaceRoutingRules failed: %v", err)
}
srvVSchema.KeyspaceRoutingRules = krr
mr, err := ts.GetMirrorRules(ctx)
if err != nil {
return fmt.Errorf("GetMirrorRules failed: %v", err)
}
srvVSchema.MirrorRules = mr
// now save the SrvVSchema in all cells in parallel
for _, cell := range cells {
wg.Add(1)
go func(cell string) {
defer wg.Done()
if err := ts.UpdateSrvVSchema(ctx, cell, srvVSchema); err != nil {
log.Error(fmt.Sprintf("%v: UpdateSrvVSchema(%v) failed", err, cell))
mu.Lock()
finalErr = err
mu.Unlock()
}
}(cell)
}
wg.Wait()
View on GitHub (pinned to 01a25a7d17)
Solutions
- Reinitialize the rules with `vtctldclient ApplyMirrorRules -rules '{"rules": []}'`, then retry the rebuild.
- Inspect the MirrorRules topo node directly and recreate it if deleted or corrupted.
- Fix the underlying topo issue (connectivity/auth) indicated by the wrapped inner error.
- If running an older Vitess binary against a newer topo layout, upgrade vtctld so it can read the MirrorRules node type.
Example fix
// before: MirrorRules node absent after topo restore
vtctldclient RebuildVSchema commerce // GetMirrorRules failed
// after
vtctldclient ApplyMirrorRules -rules '{"rules": []}'
vtctldclient RebuildVSchema commerce Defensive patterns
Strategy: validation
Validate before calling
if _, err := ts.GetMirrorRules(ctx); err != nil {
ts.SaveMirrorRules(ctx, &vschemapb.MirrorRules{Rules: []*vschemapb.MirrorRule{}})
} Try / catch
err := ts.RebuildSrvVSchema(ctx, cells)
if err != nil && strings.Contains(err.Error(), "GetMirrorRules failed") {
if reErr := ts.SaveMirrorRules(ctx, &vschemapb.MirrorRules{}); reErr == nil {
err = ts.RebuildSrvVSchema(ctx, cells)
}
}
return err Prevention
- Initialize mirror rules once at cluster bootstrap so the topo node always exists.
- Use ApplyMirrorRules for all mutations.
- Ensure topo restores/migrations cover newer node types.
- Keep vtctld version compatible with the topo schema in use.
When it happens
Trigger: Calling RebuildSrvVSchema (or its callers: ApplyRoutingRules, InitMirrorRules, vschema watcher) when the MirrorRules topo object cannot be read — node absent, protobuf decode failure, or topo backend error.
Common situations: MirrorRules node never initialized or manually removed; topo restore skipped newer node types introduced in later Vitess versions; transient etcd/zk errors; permissions on the mirror rules key.
Related errors
- SrvVSchema has no entry for keyspace %v
- GetKnownCells failed: %v
- GetKeyspaces failed: %v
- GetRoutingRules failed: %v
- GetShardRoutingRules failed: %v
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/3a15fe45f51ce5d8.
Report an issue: GitHub.