{"record":{"id":"375d063c22cdf7de","repo":"vitessio/vitess","slug":"gettabletmap-failed-w","errorCode":null,"errorMessage":"GetTabletMap() failed: %w","messagePattern":"GetTabletMap\\(\\) failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/grpcvtctldserver/topo.go","lineNumber":166,"sourceCode":"\t\t}\n\tcase err == nil:\n\t\t// If a ShardReplication object exists, we trust it to have all the\n\t\t// tablet records for the shard in that cell.\n\t\taliases = make([]*topodatapb.TabletAlias, len(sri.Nodes))\n\n\t\tfor i, node := range sri.Nodes {\n\t\t\taliases[i] = node.TabletAlias\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"GetShardReplication(%v, %v, %v) failed: %w\", cell, keyspace, shard, err)\n\t}\n\n\t// Get all the tablet records for the aliases we've collected. Note that\n\t// GetTabletMap ignores ErrNoNode, which is convenient for our purpose; it\n\t// means a tablet was deleted but is still referenced.\n\ttabletMap, err := ts.GetTabletMap(ctx, aliases, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"GetTabletMap() failed: %w\", err)\n\t}\n\n\t// In the case where no ShardReplication object exists, we collect the\n\t// aliases of every tablet in the cell, so we'll need to filter\n\t// out anything not in our shard.\n\tfor alias, ti := range tabletMap {\n\t\tif ti.Keyspace != keyspace || ti.Shard != shard {\n\t\t\tdelete(tabletMap, alias)\n\t\t}\n\t}\n\n\t// If there are any tablets in the shard in the cell, delete them.\n\tif len(tabletMap) > 0 {\n\t\tif !recursive {\n\t\t\treturn vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, \"Shard %v/%v still hase %v tablets in cell %v; use Recursive = true or remove them manually\", keyspace, shard, len(tabletMap), cell)\n\t\t}\n\n\t\tlog.Info(fmt.Sprintf(\"Deleting all %d tablets in shard %v/%v cell %v\", len(tabletMap), keyspace, shard, cell))","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/grpcvtctldserver/topo.go#L148-L184","documentation":"deleteShardCell wraps a failure from ts.GetTabletMap, which fetches tablet records for all collected aliases (ignoring ErrNoNode). Only non-ErrNoNode failures bubble up here, meaning the topo could not be queried for tablet records at all.","triggerScenarios":"DeleteShard reaches tablet-record loading but ts.GetTabletMap(ctx, aliases, nil) fails: topo RPC error, timeout, or authentication/ACL failure against tablet paths.","commonSituations":"Large shards with many aliases hitting topo timeouts; topo server restart mid-deletion; ACLs changed so vtctld cannot read tablet records; network partition between vtctld and topo cells.","solutions":["Check vtctld-to-topo connectivity and increase topo RPC timeouts if timeouts recur","Verify topo ACLs allow reading tablet paths for the vtctld identity","Retry DeleteShard; already-deleted tablets are skipped on re-run","If a specific tablet path is corrupt, remove/repair that node in the topo directly"],"exampleFix":"// before\nvtctldclient DeleteShard --recursive ks/shard  # GetTabletMap timeout on 100-tablet shard\n// after\n# scale topo / raise timeout, then retry in batches by cell\nvtctldclient DeleteShard --recursive --cells=c0 ks/shard","handlingStrategy":"retry","validationCode":"// Precheck tablet record reads for the shard\naliases, err := ts.GetTabletAliasesByCell(ctx, cell)\nif err == nil {\n\tif _, err := ts.GetTabletMap(ctx, aliases, nil); err != nil {\n\t\tlog.Warning(\"tablet records unreadable before DeleteShard\", slog.Any(\"error\", err))\n\t}\n}","typeGuard":null,"tryCatchPattern":"if err := deleteShard(...); err != nil && strings.Contains(err.Error(), \"GetTabletMap\") {\n\t// topo timeout/ACL issue: increase timeouts, fix ACLs, retry\n}","preventionTips":["Size topo servers for large-shard fan-out reads","Keep vtctld topo credentials valid","Avoid topo restarts during destructive operations"],"tags":["topo","vtctld","tablet-records"],"backgroundTag":"topo-server-unreachable","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}