vitessio/vitess · error

GetTabletMap() failed: %w

Error message

GetTabletMap() failed: %w

What it means

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.

Source

Thrown at go/vt/vtctl/grpcvtctldserver/topo.go:166

		}
	case err == nil:
		// If a ShardReplication object exists, we trust it to have all the
		// tablet records for the shard in that cell.
		aliases = make([]*topodatapb.TabletAlias, len(sri.Nodes))

		for i, node := range sri.Nodes {
			aliases[i] = node.TabletAlias
		}
	default:
		return fmt.Errorf("GetShardReplication(%v, %v, %v) failed: %w", cell, keyspace, shard, err)
	}

	// Get all the tablet records for the aliases we've collected. Note that
	// GetTabletMap ignores ErrNoNode, which is convenient for our purpose; it
	// means a tablet was deleted but is still referenced.
	tabletMap, err := ts.GetTabletMap(ctx, aliases, nil)
	if err != nil {
		return fmt.Errorf("GetTabletMap() failed: %w", err)
	}

	// In the case where no ShardReplication object exists, we collect the
	// aliases of every tablet in the cell, so we'll need to filter
	// out anything not in our shard.
	for alias, ti := range tabletMap {
		if ti.Keyspace != keyspace || ti.Shard != shard {
			delete(tabletMap, alias)
		}
	}

	// If there are any tablets in the shard in the cell, delete them.
	if len(tabletMap) > 0 {
		if !recursive {
			return 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)
		}

		log.Info(fmt.Sprintf("Deleting all %d tablets in shard %v/%v cell %v", len(tabletMap), keyspace, shard, cell))

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Check vtctld-to-topo connectivity and increase topo RPC timeouts if timeouts recur
  2. Verify topo ACLs allow reading tablet paths for the vtctld identity
  3. Retry DeleteShard; already-deleted tablets are skipped on re-run
  4. If a specific tablet path is corrupt, remove/repair that node in the topo directly

Example fix

// before
vtctldclient DeleteShard --recursive ks/shard  # GetTabletMap timeout on 100-tablet shard
// after
# scale topo / raise timeout, then retry in batches by cell
vtctldclient DeleteShard --recursive --cells=c0 ks/shard
Defensive patterns

Strategy: retry

Validate before calling

// Precheck tablet record reads for the shard
aliases, err := ts.GetTabletAliasesByCell(ctx, cell)
if err == nil {
	if _, err := ts.GetTabletMap(ctx, aliases, nil); err != nil {
		log.Warning("tablet records unreadable before DeleteShard", slog.Any("error", err))
	}
}

Try / catch

if err := deleteShard(...); err != nil && strings.Contains(err.Error(), "GetTabletMap") {
	// topo timeout/ACL issue: increase timeouts, fix ACLs, retry
}

Prevention

When it happens

Trigger: DeleteShard reaches tablet-record loading but ts.GetTabletMap(ctx, aliases, nil) fails: topo RPC error, timeout, or authentication/ACL failure against tablet paths.

Common situations: 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.

Related errors


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