{"record":{"id":"135731e17ab75394","repo":"vitessio/vitess","slug":"getshardreplication-v-v-v-failed-w","errorCode":null,"errorMessage":"GetShardReplication(%v, %v, %v) failed: %w","messagePattern":"GetShardReplication\\((.+?), (.+?), (.+?)\\) failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/grpcvtctldserver/topo.go","lineNumber":158,"sourceCode":"\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 {\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}","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/grpcvtctldserver/topo.go#L140-L176","documentation":"deleteShardCell returns this when reading the shard's ShardReplication object fails with an error other than ErrNoNode. The ShardReplication record is the authoritative list of tablets in the shard per cell; failing to read it aborts shard deletion for that cell.","triggerScenarios":"Calling DeleteShard where ts.GetShardReplication(ctx, cell, keyspace, shard) returns a non-NoNode error: topo connection failure, permission error, or malformed shard path.","commonSituations":"Topo server outage during shard deletion; partial topo migration leaving keyspace/shard paths unreadable; wrong keyspace/shard spelling is NOT this (that yields NoNode, handled separately) but RPC/ACL errors are.","solutions":["Check topo server health and connectivity from vtctld","Inspect topo ACLs/permissions for the vtctld identity on the shard path","Re-run DeleteShard after the transient error clears; it is safe to retry","If the shard path is corrupt, inspect the topo directly (etcdctl/zkCli) and repair or remove the stale ShardReplication node"],"exampleFix":"// before\nvtctldclient DeleteShard ks/shard  # fails while topo is down\n// after\n# verify topo, then retry\nvtctldclient GetShard ks/shard && vtctldclient DeleteShard ks/shard","handlingStrategy":"retry","validationCode":"// Precheck shard replication readability\nif _, err := ts.GetShardReplication(ctx, cell, keyspace, shard); err != nil && !topo.IsErrType(err, topo.NoNode) {\n\treturn fmt.Errorf(\"precheck failed for %s/%s in %s: %w\", keyspace, shard, cell, err)\n}","typeGuard":null,"tryCatchPattern":"err := vtctldClient.DeleteShard(ctx, ks, shard)\nif err != nil && strings.Contains(err.Error(), \"GetShardReplication\") {\n\t// transient topo error: back off and retry\n}","preventionTips":["Ensure topo stability before bulk shard teardown","Check ACLs on shard paths","Retry idempotently: DeleteShard skips already-deleted tablets"],"tags":["topo","vtctld","shard-management","replication-graph"],"backgroundTag":"topo-server-unreachable","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}