{"record":{"id":"54bafe197711181f","repo":"vitessio/vitess","slug":"rebuildvschemagraph-failed-v","errorCode":null,"errorMessage":"RebuildVSchemaGraph failed: %v","messagePattern":"RebuildVSchemaGraph failed: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtcombo/tablet_map.go","lineNumber":224,"sourceCode":"\t// main() forces the --tablet-manager-protocol flag to this value.\n\ttmclient.RegisterTabletManagerClientFactory(\"internal\", func() tmclient.TabletManagerClient {\n\t\treturn &internalTabletManagerClient{}\n\t})\n\n\t// iterate through the keyspaces\n\twr := wrangler.New(env, logutil.NewConsoleLogger(), ts, nil)\n\tvar uid uint32 = 1\n\tfor _, kpb := range tpb.Keyspaces {\n\t\tvar err error\n\t\tuid, err = CreateKs(ctx, env, ts, tpb, mysqld, dbcfgs, schemaDir, kpb, ensureDatabase, uid, wr, srvTopoCounts)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\t// Rebuild the SrvVSchema object\n\tif err := ts.RebuildSrvVSchema(ctx, tpb.Cells); err != nil {\n\t\treturn 0, fmt.Errorf(\"RebuildVSchemaGraph failed: %v\", err)\n\t}\n\n\t// Register the tablet dialer for tablet server. main() forces the --tablet-protocol\n\t// flag to this value.\n\ttabletconn.RegisterDialer(\"internal\", dialer)\n\n\t// run healthcheck on all vttablets\n\ttmc := tmclient.NewTabletManagerClient()\n\tfor _, tablet := range tabletMap {\n\t\ttabletInfo, err := ts.GetTablet(ctx, tablet.alias)\n\t\tif err != nil {\n\t\t\treturn 0, fmt.Errorf(\"cannot find tablet: %+v\", tablet.alias)\n\t\t}\n\t\ttmc.RunHealthCheck(ctx, tabletInfo.Tablet)\n\t}\n\n\treturn uid, nil\n}","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtcombo/tablet_map.go#L206-L242","documentation":"vtcombo's InitTabletMap rebuilds the SrvVSchema (vschema graph) in all configured cells via ts.RebuildSrvVSchema after creating tablets. Failure is wrapped as 'RebuildVSchemaGraph failed'. The vschema rebuild propagates keyspace vschema info into the topo service; errors usually indicate topo write/read problems or invalid vschema content.","triggerScenarios":"Calling InitTabletMap (vtcombo startup / run) when RebuildSrvVSchema fails: topo server unreachable, permission errors writing SrvVSchema, or a keyspace with an invalid vschema that fails validation during rebuild.","commonSituations":"etcd2/zk2 topo not reachable from the vtcombo process; topo auth misconfigured; corrupted topo data from a previous crashed run; invalid JSON vschema uploaded for a keyspace.","solutions":["Verify topo server connectivity and credentials for all cells listed in --cells.","Validate each keyspace's vschema (vtctldclient GetVSchema / validate JSON) and fix invalid vschema content.","Inspect topo data for stale/corrupt SrvVSchema entries and clean them up, then retry InitTabletMap."],"exampleFix":"// before (invalid vschema in topo)\n{\"tables\": {\"t1\": {\"malformed\": true}}}\n// after\n{\"tables\": {\"t1\": {\"column_vindexes\": [...]}}}","handlingStrategy":"validation","validationCode":"// Shell: validate topo reachability before vtcombo init\ncurl -sf \"$TOPO_ETCD_URL/vt/global\" >/dev/null || { echo \"topo unreachable\"; exit 1; }\nvtctldclient GetKeyspaces >/dev/null || { echo \"topo read failed\"; exit 1; }","typeGuard":null,"tryCatchPattern":"uid, err := InitTabletMap(...)\nif err != nil && strings.Contains(err.Error(), \"RebuildVSchemaGraph failed\") {\n    // check topo connectivity and per-keyspace vschema validity\n}","preventionTips":["Confirm the topo server is reachable and writable from the vtcombo process before init.","Validate all keyspaces' vschema JSON before startup.","Clean stale SrvVSchema entries from crashed prior runs."],"tags":["vtcombo","topology","vschema"],"backgroundTag":"vschema-rebuild-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}