{"record":{"id":"cbc6814bed11b224","repo":"vitessio/vitess","slug":"rebuildsrvvschema-v-w","errorCode":null,"errorMessage":"RebuildSrvVSchema(%v) = %w","messagePattern":"RebuildSrvVSchema\\((.+?)\\) = %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/grpcvtctldserver/server.go","lineNumber":1017,"sourceCode":"\t\t// so we do NOT call bksvs.CloneVT() here. We instead only\n\t\t// clone the vschemapb.Keyspace field for the new snapshot\n\t\t// keyspace.\n\t\tsksvs := &topo.KeyspaceVSchemaInfo{\n\t\t\tName:     req.Name,\n\t\t\tKeyspace: bksvs.Keyspace.CloneVT(),\n\t\t}\n\t\t// SNAPSHOT keyspaces are excluded from global routing.\n\t\tsksvs.RequireExplicitRouting = true\n\n\t\tif err = s.ts.SaveVSchema(ctx, sksvs); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"SaveVSchema(%v) = %w\", sksvs, err)\n\t\t}\n\t}\n\n\tcells := []string{}\n\terr = s.ts.RebuildSrvVSchema(ctx, cells)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"RebuildSrvVSchema(%v) = %w\", cells, err)\n\t}\n\n\treturn &vtctldatapb.CreateKeyspaceResponse{\n\t\tKeyspace: &vtctldatapb.Keyspace{\n\t\t\tName:     req.Name,\n\t\t\tKeyspace: ki,\n\t\t},\n\t}, nil\n}\n\n// CreateShard is part of the vtctlservicepb.VtctldServer interface.\nfunc (s *VtctldServer) CreateShard(ctx context.Context, req *vtctldatapb.CreateShardRequest) (resp *vtctldatapb.CreateShardResponse, err error) {\n\tspan, ctx := trace.NewSpan(ctx, \"VtctldServer.CreateShard\")\n\tdefer span.Finish()\n\n\tdefer panicHandler(&err)\n\n\tspan.Annotate(\"keyspace\", req.Keyspace)","sourceCodeStart":999,"sourceCodeEnd":1035,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/grpcvtctldserver/server.go#L999-L1035","documentation":"After creating the keyspace (and VSchema for snapshots), CreateKeyspace rebuilds the per-cell serving VSchema so routers learn about the new keyspace. An empty cells slice means rebuild in all known cells; if RebuildSrvVSchema fails for any cell, the error is wrapped as RebuildSrvVSchema(%v) = %w and the RPC returns it.","triggerScenarios":"Any CreateKeyspace call where rebuilding serving vshards fails: topo write errors, a cell unreachable, or an existing corrupt SrvVSchema node in one of the cells.","commonSituations":"A dead/decommissioned cell still listed in the topo; network partition to one cell's topo backend; permission issues on SrvVSchema paths.","solutions":["Read the wrapped cause to identify which cell failed","Fix topo connectivity or remove the dead cell from the known cells list","Manually run RebuildVSchema (vtctldclient RebuildVSchemaGraph) after correcting the issue","Verify SrvVSchema entries per cell with GetSrvVSchema"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"for _, cell := range cells {\n    if _, err := ts.GetSrvVSchema(ctx, cell); err != nil {\n        log.Printf(\"cell %s srv vschema unreadable: %v\", cell, err)\n    }\n}","typeGuard":null,"tryCatchPattern":"_, err := client.CreateKeyspace(ctx, req)\nif err != nil && strings.Contains(err.Error(), \"RebuildSrvVSchema\") {\n    // inspect which cell failed; fix/remove it and run RebuildVSchemaGraph\n}","preventionTips":["Keep the cell list current; remove decommissioned cells","Rebuild the VSchema graph after any topo maintenance","Ensure all cells' topo backends are writable by vtctld","Periodically verify per-cell SrvVSchema entries"],"tags":["vitess","topology","vschema","rebuild"],"backgroundTag":"srv-vschema-rebuild-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}