{"record":{"id":"3a15fe45f51ce5d8","repo":"vitessio/vitess","slug":"getmirrorrules-failed-v","errorCode":null,"errorMessage":"GetMirrorRules failed: %v","messagePattern":"GetMirrorRules failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/topo/srv_vschema.go","lineNumber":218,"sourceCode":"\t\treturn fmt.Errorf(\"GetRoutingRules failed: %v\", err)\n\t}\n\tsrvVSchema.RoutingRules = rr\n\n\tsrr, err := ts.GetShardRoutingRules(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"GetShardRoutingRules failed: %v\", err)\n\t}\n\tsrvVSchema.ShardRoutingRules = srr\n\n\tkrr, err := ts.GetKeyspaceRoutingRules(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"GetKeyspaceRoutingRules failed: %v\", err)\n\t}\n\tsrvVSchema.KeyspaceRoutingRules = krr\n\n\tmr, err := ts.GetMirrorRules(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"GetMirrorRules failed: %v\", err)\n\t}\n\tsrvVSchema.MirrorRules = mr\n\n\t// now save the SrvVSchema in all cells in parallel\n\tfor _, cell := range cells {\n\t\twg.Add(1)\n\t\tgo func(cell string) {\n\t\t\tdefer wg.Done()\n\t\t\tif err := ts.UpdateSrvVSchema(ctx, cell, srvVSchema); err != nil {\n\t\t\t\tlog.Error(fmt.Sprintf(\"%v: UpdateSrvVSchema(%v) failed\", err, cell))\n\t\t\t\tmu.Lock()\n\t\t\t\tfinalErr = err\n\t\t\t\tmu.Unlock()\n\t\t\t}\n\t\t}(cell)\n\t}\n\twg.Wait()\n","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/topo/srv_vschema.go#L200-L236","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before: MirrorRules node absent after topo restore\nvtctldclient RebuildVSchema commerce  // GetMirrorRules failed\n// after\nvtctldclient ApplyMirrorRules -rules '{\"rules\": []}'\nvtctldclient RebuildVSchema commerce","handlingStrategy":"validation","validationCode":"if _, err := ts.GetMirrorRules(ctx); err != nil {\n    ts.SaveMirrorRules(ctx, &vschemapb.MirrorRules{Rules: []*vschemapb.MirrorRule{}})\n}","typeGuard":null,"tryCatchPattern":"err := ts.RebuildSrvVSchema(ctx, cells)\nif err != nil && strings.Contains(err.Error(), \"GetMirrorRules failed\") {\n    if reErr := ts.SaveMirrorRules(ctx, &vschemapb.MirrorRules{}); reErr == nil {\n        err = ts.RebuildSrvVSchema(ctx, cells)\n    }\n}\nreturn err","preventionTips":["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."],"tags":["topo","vschema","mirror-rules"],"backgroundTag":"topo-object-missing","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}