vitessio/vitess · error

tablet manager client is not initialized

Error message

tablet manager client is not initialized

What it means

isPrimaryReachable uses the tablet manager client (tmc) to ping the primary tablet, but the client interface is nil in this vtorc process. Since vtorc was built/run without a tablet manager client implementation, reachability checks cannot be performed.

Source

Thrown at go/vt/vtorc/logic/topology_recovery.go:474

		return false, nil
	}

	tablet, err := inst.ReadTablet(analysisEntry.AnalyzedInstanceAlias)
	if err != nil {
		return false, fmt.Errorf("failed to read tablet %q from vtorc db: %w", topoproto.TabletAliasString(analysisEntry.AnalyzedInstanceAlias), err)
	}

	if tablet == nil || tablet.Hostname == "" || tablet.PortMap == nil {
		return false, nil
	}

	grpcPort, ok := tablet.PortMap["grpc"]
	if !ok || grpcPort == 0 {
		return false, nil
	}

	if tmc == nil {
		return false, errors.New("tablet manager client is not initialized")
	}

	ctx, cancel := context.WithTimeout(ctx, 2*time.Second)
	defer cancel()

	if err := tmc.Ping(ctx, tablet); err != nil {
		return false, err
	}

	return true, nil
}

// recoverPrimaryTabletDeleted tries to run a recovery for the case where the primary tablet has been deleted.
func recoverPrimaryTabletDeleted(ctx context.Context, analysisEntry *inst.DetectionAnalysis, logger *log.PrefixedLogger) (recoveryAttempted bool, topologyRecovery *TopologyRecovery, err error) {
	return runEmergencyReparentOp(ctx, analysisEntry, "PrimaryTabletDeleted", true, logger)
}

func postErsCompletion(topologyRecovery *TopologyRecovery, analysisEntry *inst.DetectionAnalysis, recoveryName string, promotedReplica *inst.Instance) {

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Run the standard vitess build that includes the grpc tablet manager client (vtctldserver/vtorc with grpc TMC enabled)
  2. Verify logic.TMC is initialized at vtorc startup before recovery checks run
  3. Check for build tags or custom forks that exclude the tablet manager client
Defensive patterns

Strategy: validation

Validate before calling

if logic.TMC == nil {
    return errors.New("vtorc started without tablet manager client; primary reachability checks unavailable")
}

Prevention

When it happens

Trigger: recoverIncapacitatedPrimary calls isPrimaryReachable on a tablet that has a grpc port, but the logic.TMC variable was never set (e.g. vtorc compiled without the grpc tablet manager client, or initialization order skipped wiring it).

Common situations: Running a vtorc build with the tablet manager client stubbed out; misconfigured vtctld/vtorc integration where SetTabletManagerClient was never called; custom builds excluding the grpc TMC.

Related errors


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