{"record":{"id":"0fc8fc865ad7bc6e","repo":"vitessio/vitess","slug":"tmclient-cannot-find-tablet-v","errorCode":null,"errorMessage":"tmclient: cannot find tablet %v","messagePattern":"tmclient: cannot find tablet (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtcombo/tablet_map.go","lineNumber":794,"sourceCode":"// internalTabletManagerClient implements tmclient.TabletManagerClient\ntype internalTabletManagerClient struct{}\n\nfunc (itmc *internalTabletManagerClient) VDiff(ctx context.Context, tablet *topodatapb.Tablet, req *tabletmanagerdatapb.VDiffRequest) (*tabletmanagerdatapb.VDiffResponse, error) {\n\treturn nil, errors.New(\"VDiff not implemented in vtcombo\")\n}\n\nfunc (itmc *internalTabletManagerClient) LockTables(ctx context.Context, tablet *topodatapb.Tablet) error {\n\treturn errors.New(\"not implemented in vtcombo\")\n}\n\nfunc (itmc *internalTabletManagerClient) UnlockTables(ctx context.Context, tablet *topodatapb.Tablet) error {\n\treturn errors.New(\"not implemented in vtcombo\")\n}\n\nfunc (itmc *internalTabletManagerClient) Ping(ctx context.Context, tablet *topodatapb.Tablet) error {\n\tt, ok := tabletMap[tablet.Alias.Uid]\n\tif !ok {\n\t\treturn fmt.Errorf(\"tmclient: cannot find tablet %v\", tablet.Alias.Uid)\n\t}\n\tt.tm.Ping(ctx, \"payload\")\n\treturn nil\n}\n\nfunc (itmc *internalTabletManagerClient) GetSchema(\n\tctx context.Context,\n\ttablet *topodatapb.Tablet,\n\trequest *tabletmanagerdatapb.GetSchemaRequest,\n) (*tabletmanagerdatapb.SchemaDefinition, error) {\n\tt, ok := tabletMap[tablet.Alias.Uid]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"tmclient: cannot find tablet %v\", tablet.Alias.Uid)\n\t}\n\treturn t.tm.GetSchema(ctx, request)\n}\n\nfunc (itmc *internalTabletManagerClient) GetPermissions(ctx context.Context, tablet *topodatapb.Tablet) (*tabletmanagerdatapb.Permissions, error) {","sourceCodeStart":776,"sourceCodeEnd":812,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtcombo/tablet_map.go#L776-L812","documentation":"vtcombo implements the tablet manager client in-process: Ping looks up the target tablet in the in-memory tabletMap keyed by alias Uid. If the tablet's Uid isn't in the map (it was never created in this vtcombo, or the map changed), this error is returned instead of pinging.","triggerScenarios":"Calling any management RPC that pings a tablet (health checks, vtctldclient Ping) with a tablet alias not present in the current vtcombo's tabletMap — e.g. referencing a tablet from another cell/keyspace that was removed, or using a stale alias after vtcombo restart.","commonSituations":"Stale topology data pointing at tablets removed from vtcombo; running a vttest shard teardown then issuing commands to the old tablet aliases; typo in the tablet UID/alias; vtcombo restarted with fewer tablets than topo references.","solutions":["Confirm the tablet UID exists in this vtcombo (check InitTabletMap output / log lines listing created tablets).","Use the correct tablet alias — re-fetch the tablet list from topo rather than caching it.","Refresh/rebuild topo data if it references removed tablets (RebuildKeyspaceGraph, prune stale tablets).","Restart vtcombo with the expected number of tablets if the setup changed."],"exampleFix":"// before: cached alias\noldAlias := \"100\"\ntmclient.Ping(ctx, tabletFromCache)\n// after: fetch current tablet from topo\nts, _ := topo.OpenServer(...)\nts.GetTablet(ctx, alias) // errors clearly if tablet is gone","handlingStrategy":"type-guard","validationCode":"// resolve the tablet from topo and check it exists before pinging\nti, err := ts.GetTablet(ctx, alias)\nif err != nil {\n\treturn fmt.Errorf(\"tablet %s not in topo: %w\", topoproto.TabletAliasString(alias), err)\n}\n_ = ti","typeGuard":"func tabletInMap(uid uint32) bool {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\t_, ok := tabletMap[uid]\n\treturn ok\n}","tryCatchPattern":"err := tmClient.Ping(ctx, tablet)\nif err != nil && strings.Contains(err.Error(), \"tmclient: cannot find tablet\") {\n\t// refresh tablet list from topo and retry with a live alias\n}","preventionTips":["Always fetch tablet aliases from topo immediately before management RPCs","Never cache tablet aliases across vtcombo restarts","Verify tablet UIDs against InitTabletMap startup logs","Clean stale tablets from topo after shard teardown"],"tags":["vtcombo","tabletmanager","topo"],"backgroundTag":"tablet-not-found","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}