vitessio/vitess · error

RebuildVSchemaGraph failed: %v

Error message

RebuildVSchemaGraph failed: %v

What it means

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.

Source

Thrown at go/vt/vtcombo/tablet_map.go:224

	// main() forces the --tablet-manager-protocol flag to this value.
	tmclient.RegisterTabletManagerClientFactory("internal", func() tmclient.TabletManagerClient {
		return &internalTabletManagerClient{}
	})

	// iterate through the keyspaces
	wr := wrangler.New(env, logutil.NewConsoleLogger(), ts, nil)
	var uid uint32 = 1
	for _, kpb := range tpb.Keyspaces {
		var err error
		uid, err = CreateKs(ctx, env, ts, tpb, mysqld, dbcfgs, schemaDir, kpb, ensureDatabase, uid, wr, srvTopoCounts)
		if err != nil {
			return 0, err
		}
	}

	// Rebuild the SrvVSchema object
	if err := ts.RebuildSrvVSchema(ctx, tpb.Cells); err != nil {
		return 0, fmt.Errorf("RebuildVSchemaGraph failed: %v", err)
	}

	// Register the tablet dialer for tablet server. main() forces the --tablet-protocol
	// flag to this value.
	tabletconn.RegisterDialer("internal", dialer)

	// run healthcheck on all vttablets
	tmc := tmclient.NewTabletManagerClient()
	for _, tablet := range tabletMap {
		tabletInfo, err := ts.GetTablet(ctx, tablet.alias)
		if err != nil {
			return 0, fmt.Errorf("cannot find tablet: %+v", tablet.alias)
		}
		tmc.RunHealthCheck(ctx, tabletInfo.Tablet)
	}

	return uid, nil
}

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Verify topo server connectivity and credentials for all cells listed in --cells.
  2. Validate each keyspace's vschema (vtctldclient GetVSchema / validate JSON) and fix invalid vschema content.
  3. Inspect topo data for stale/corrupt SrvVSchema entries and clean them up, then retry InitTabletMap.

Example fix

// before (invalid vschema in topo)
{"tables": {"t1": {"malformed": true}}}
// after
{"tables": {"t1": {"column_vindexes": [...]}}}
Defensive patterns

Strategy: validation

Validate before calling

// Shell: validate topo reachability before vtcombo init
curl -sf "$TOPO_ETCD_URL/vt/global" >/dev/null || { echo "topo unreachable"; exit 1; }
vtctldclient GetKeyspaces >/dev/null || { echo "topo read failed"; exit 1; }

Try / catch

uid, err := InitTabletMap(...)
if err != nil && strings.Contains(err.Error(), "RebuildVSchemaGraph failed") {
    // check topo connectivity and per-keyspace vschema validity
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/54bafe197711181f. Report an issue: GitHub.