{"record":{"id":"7e0e6415e59dd366","repo":"vitessio/vitess","slug":"tablet-manager-client-is-not-initialized","errorCode":null,"errorMessage":"tablet manager client is not initialized","messagePattern":"tablet manager client is not initialized","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtorc/logic/topology_recovery.go","lineNumber":474,"sourceCode":"\t\treturn false, nil\n\t}\n\n\ttablet, err := inst.ReadTablet(analysisEntry.AnalyzedInstanceAlias)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"failed to read tablet %q from vtorc db: %w\", topoproto.TabletAliasString(analysisEntry.AnalyzedInstanceAlias), err)\n\t}\n\n\tif tablet == nil || tablet.Hostname == \"\" || tablet.PortMap == nil {\n\t\treturn false, nil\n\t}\n\n\tgrpcPort, ok := tablet.PortMap[\"grpc\"]\n\tif !ok || grpcPort == 0 {\n\t\treturn false, nil\n\t}\n\n\tif tmc == nil {\n\t\treturn false, errors.New(\"tablet manager client is not initialized\")\n\t}\n\n\tctx, cancel := context.WithTimeout(ctx, 2*time.Second)\n\tdefer cancel()\n\n\tif err := tmc.Ping(ctx, tablet); err != nil {\n\t\treturn false, err\n\t}\n\n\treturn true, nil\n}\n\n// recoverPrimaryTabletDeleted tries to run a recovery for the case where the primary tablet has been deleted.\nfunc recoverPrimaryTabletDeleted(ctx context.Context, analysisEntry *inst.DetectionAnalysis, logger *log.PrefixedLogger) (recoveryAttempted bool, topologyRecovery *TopologyRecovery, err error) {\n\treturn runEmergencyReparentOp(ctx, analysisEntry, \"PrimaryTabletDeleted\", true, logger)\n}\n\nfunc postErsCompletion(topologyRecovery *TopologyRecovery, analysisEntry *inst.DetectionAnalysis, recoveryName string, promotedReplica *inst.Instance) {","sourceCodeStart":456,"sourceCodeEnd":492,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtorc/logic/topology_recovery.go#L456-L492","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Run the standard vitess build that includes the grpc tablet manager client (vtctldserver/vtorc with grpc TMC enabled)","Verify logic.TMC is initialized at vtorc startup before recovery checks run","Check for build tags or custom forks that exclude the tablet manager client"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if logic.TMC == nil {\n    return errors.New(\"vtorc started without tablet manager client; primary reachability checks unavailable\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the standard vitess vtorc build with the grpc TMC wired in","Assert TMC initialization in startup/health checks before enabling recovery","Add a readiness check that fails fast if TMC is nil"],"tags":["vtorc","tablet-manager-client","initialization"],"backgroundTag":"dependency-not-initialized","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}