{"record":{"id":"5092afb6b31521b0","repo":"vitessio/vitess","slug":"gettabletaliasesbycell-v-failed-w","errorCode":null,"errorMessage":"GetTabletAliasesByCell(%v) failed: %w","messagePattern":"GetTabletAliasesByCell\\((.+?)\\) failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/grpcvtctldserver/topo.go","lineNumber":147,"sourceCode":"\tspan.Annotate(\"keyspace\", keyspace)\n\tspan.Annotate(\"shard\", shard)\n\tspan.Annotate(\"cell\", cell)\n\tspan.Annotate(\"recursive\", recursive)\n\n\tvar aliases []*topodatapb.TabletAlias\n\n\t// Get the ShardReplication object for the cell. Collect all the tablets\n\t// that belong to the shard.\n\tsri, err := ts.GetShardReplication(ctx, cell, keyspace, shard)\n\tswitch {\n\tcase topo.IsErrType(err, topo.NoNode):\n\t\t// No ShardReplication object means that the topo is inconsistent.\n\t\t// Therefore we read all the tablets for that cell, and if we find any\n\t\t// in our shard, we'll either abort or try to delete them, depending on\n\t\t// whether recursive=true.\n\t\taliases, err = ts.GetTabletAliasesByCell(ctx, cell)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"GetTabletAliasesByCell(%v) failed: %w\", cell, err)\n\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 {","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/grpcvtctldserver/topo.go#L129-L165","documentation":"deleteShardCell wraps any failure from GetTabletAliasesByCell when the ShardReplication object is missing for a cell, so it falls back to listing all tablets in the cell. The wrap includes the cell name and the underlying topo server error, indicating the per-cell tablet listing could not be read.","triggerScenarios":"Calling DeleteShard (vtctldserver) for a shard whose ShardReplication object is absent in a cell while GetTabletAliasesByCell(ctx, cell) fails due to a topo connection error, missing/misconfigured cell, or topo server outage.","commonSituations":"Topology server (etcd/zk) down or unreachable; cell name not registered in topo (wrong --cells_to_watch or stale cell config); topo data corrupted or manually deleted; running DeleteShard against a cell after a topo migration left it inconsistent.","solutions":["Verify the topo server for that cell is reachable (vtctldclient GetTablets --cell <cell> or check vtgate/vtctld topo flags)","Check the cell is registered: it must exist in the topo's cells list; re-add with vtctl AddCellInfo if missing","If the topo is intentionally inconsistent, repair ShardReplication via topo repair commands (vtctl RepairShardReplication / prism repair) then retry DeleteShard","Retry once the transient topo outage resolves; DeleteShard is idempotent for already-deleted tablets"],"exampleFix":"// before\ncmd/vtctldclient DeleteShard --recursive ks/shard --cells=badcell\n// after\nvtctldclient GetTablets --cell badcell   # confirm topo connectivity first\nvtctldclient DeleteShard --recursive ks/shard --cells=badcell","handlingStrategy":"validation","validationCode":"// Check cell readability before DeleteShard\nif _, err := ts.GetTabletAliasesByCell(ctx, cell); err != nil {\n\treturn fmt.Errorf(\"cell %s unreadable, aborting DeleteShard: %w\", cell, err)\n}","typeGuard":null,"tryCatchPattern":"if err := vtctldClient.DeleteShard(ctx, keyspace, shard); err != nil {\n\tif strings.Contains(err.Error(), \"GetTabletAliasesByCell\") {\n\t\t// topo/cell issue: verify cell and topo, then retry\n\t}\n\treturn err\n}","preventionTips":["Verify cell names with the topo before shard operations","Monitor topo server health from vtctld","Avoid manual edits to topo data that remove ShardReplication objects"],"tags":["topo","vtctld","shard-management"],"backgroundTag":"topo-server-unreachable","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}