vitessio/vitess · error
GetTabletMap() failed: %v
Error message
GetTabletMap() failed: %v
What it means
DeleteShard first gathers all tablet aliases registered for the shard, then loads their full records via topo.Server.GetTabletMap. That call aggregates per-tablet lookup errors; if it fails for a reason other than a single missing node (e.g. topo server connection issues), DeleteShard aborts with this wrapped message.
Source
Thrown at go/vt/wrangler/shard.go:118
}
case err == nil:
// We found a ShardReplication object. We
// trust it to have all tablet records.
aliases = make([]*topodatapb.TabletAlias, len(sri.Nodes))
for i, n := range sri.Nodes {
aliases[i] = n.TabletAlias
}
default:
return fmt.Errorf("GetShardReplication(%v, %v, %v) failed: %v", cell, keyspace, shard, err)
}
// Get the corresponding Tablet records. Note
// GetTabletMap ignores ErrNoNode, and it's good for
// our purpose, it means a tablet was deleted but is
// still referenced.
tabletMap, err := wr.ts.GetTabletMap(ctx, aliases, nil)
if err != nil {
return fmt.Errorf("GetTabletMap() failed: %v", err)
}
// Remove the tablets that don't belong to our
// keyspace/shard from the map.
for a, ti := range tabletMap {
if ti.Keyspace != keyspace || ti.Shard != shard {
delete(tabletMap, a)
}
}
// Now see if we need to DeleteTablet, and if we can, do it.
if len(tabletMap) > 0 {
if !recursive {
return fmt.Errorf("shard %v/%v still has %v tablets in cell %v; use -recursive or remove them manually", keyspace, shard, len(tabletMap), cell)
}
wr.Logger().Infof("Deleting all tablets in shard %v/%v cell %v", keyspace, shard, cell)
for tabletAlias, tabletInfo := range tabletMap {View on GitHub (pinned to 01a25a7d17)
Solutions
- Check connectivity to the topo server (zk/etcd) and retry the DeleteShard command; DeleteShard is idempotent for already-deleted tablets.
- Inspect the wrapped inner error (`%v` at the end of the message) to identify which tablet alias or topo operation failed.
- Verify vtctld is started with the correct topo server flags (--topo_implementation, --topo_global_server_address, --topo_global_root).
- If a specific tablet record is corrupt, delete it with `vtctldclient DeleteTablet <alias>` and re-run DeleteShard.
Example fix
// before vtctldclient --server :15999 DeleteShard commerce/0 // fails with topo read error // after # fix topo connectivity, then retry vtctldclient --server :15999 --topo_implementation etcd2 --topo_global_server_address localhost:2379 DeleteShard commerce/0
Defensive patterns
Strategy: retry
Validate before calling
// Go: verify topo reachability before DeleteShard
aliases, err := ts.GetTabletAliasesByShard(ctx, keyspace, shard)
if err != nil {
return fmt.Errorf("topo not readable, aborting DeleteShard: %w", err)
}
_ = aliases Try / catch
// Go: retry transient topo errors
var lastErr error
for i := 0; i < 3; i++ {
err := wr.DeleteShard(ctx, keyspace, shard, nil, true)
if err == nil {
return nil
}
lastErr = err
if strings.Contains(err.Error(), "GetTabletMap() failed") {
time.Sleep(2 * time.Second)
continue
}
break
}
return lastErr Prevention
- Monitor topo server (zk/etcd) health before running destructive workflows
- Pass correct topo flags to vtctldclient
- Retry DeleteShard — it is idempotent for already-deleted tablets
When it happens
Trigger: Calling DeleteShard (via `vtctldclient DeleteShard`) when the topo server cannot read one or more tablet records — e.g. topo server outage, permission errors, or malformed tablet records — and GetTabletMap returns a non-nil error other than ignorable ErrNoNode entries.
Common situations: Zookeeper/etcd connectivity problems during shard teardown; a partially deleted shard where topo reads fail intermittently; run with wrong topo flags pointing at the wrong topo server.
Related errors
- can't delete tablet %v: %v
- cannot delete SrvKeyspace from cell %v for keyspace %v: %w
- source shard must have a primary for copying schema: %v
- no primary in shard %v/%v
- shard %v/%v still has %v tablets in cell %v; use -recursive
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/326d809d8dde4836.
Report an issue: GitHub.