vitessio/vitess · error

GetTabletsByCell(%v) failed: %v

Error message

GetTabletsByCell(%v) failed: %v

What it means

During DeleteShard, when the ShardReplication object for a cell is missing (topo inconsistency), the code falls back to listing all tablet aliases in that cell via GetTabletAliasesByCell to find tablets belonging to the keyspace/shard. This error wraps a failure of that fallback listing - the cell's tablet list could not be read from the topo server.

Source

Thrown at go/vt/wrangler/shard.go:99

	}

	// Go through all the cells.
	for _, cell := range cells {
		var aliases []*topodatapb.TabletAlias

		// Get the ShardReplication object for that cell. Try
		// to find all tablets that may belong to our shard.
		sri, err := wr.ts.GetShardReplication(ctx, cell, keyspace, shard)
		switch {
		case topo.IsErrType(err, topo.NoNode):
			// No ShardReplication object. It means the
			// topo is inconsistent. Let's read all the
			// tablets for that cell, and if we find any
			// in our keyspace / shard, either abort or
			// try to delete them.
			aliases, err = wr.ts.GetTabletAliasesByCell(ctx, cell)
			if err != nil {
				return fmt.Errorf("GetTabletsByCell(%v) failed: %v", cell, err)
			}
		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 {

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Check connectivity/health of the topo server for the failing cell.
  2. Verify the cell name is valid and still registered (vtctldclient GetCellInfo <cell>).
  3. Repair or manually clean the inconsistent ShardReplication state, then retry DeleteShard.
Defensive patterns

Strategy: retry

Validate before calling

if _, err := ts.GetCellInfoNames(ctx); err != nil {
    return fmt.Errorf("topo cells unreadable: %v", err)
}

Try / catch

err := wr.DeleteShard(ctx, keyspace, shard, evenIfServing, recursive)
if err != nil && strings.Contains(err.Error(), "GetTabletsByCell") {
    // check topo health for that cell, retry
}

Prevention

When it happens

Trigger: ShardReplication is missing for a cell (fallback path triggers) AND GetTabletAliasesByCell fails for that cell - topo server outage, invalid cell alias, or the cell being unreachable.

Common situations: Partially torn-down cell whose ShardReplication nodes were deleted but the cell is still listed; etcd/zk connectivity problems to that cell; typo'd or decommissioned cell name in the shard's cell list.

Related errors


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