vitessio/vitess · error · topo.NewError(topo.NoUpdateNeeded)
%w: no SourceShard with uid %v
Error message
%w: no SourceShard with uid %v
What it means
Returned by RemoveShardSourceShard when no SourceShard with the given UID exists on the shard. Wrapped in topo.NoUpdateNeeded so the shard record is left untouched. It indicates the requested removal target does not match any registered vreplication source shard.
Source
Thrown at go/vt/vtctl/grpcvtctldserver/server.go:4415
var si *topo.ShardInfo
ctx, unlock, lockErr := s.ts.LockKeyspace(ctx, req.Keyspace, fmt.Sprintf("SourceShardDelete(%v)", req.Uid))
if lockErr != nil {
err = lockErr
return nil, err
}
defer unlock(&err)
si, err = s.ts.UpdateShardFields(ctx, req.Keyspace, req.Shard, func(si *topo.ShardInfo) error {
var newSourceShards []*topodatapb.Shard_SourceShard
for _, ss := range si.SourceShards {
if ss.Uid != req.Uid {
newSourceShards = append(newSourceShards, ss)
}
}
if len(newSourceShards) == len(si.SourceShards) {
return fmt.Errorf("%w: no SourceShard with uid %v", topo.NewError(topo.NoUpdateNeeded, fmt.Sprintf("%s/%s", req.Keyspace, req.Shard)), req.Uid)
}
si.SourceShards = newSourceShards
return nil
})
if err != nil {
return nil, err
}
resp = &vtctldatapb.SourceShardDeleteResponse{}
switch si {
case nil:
// If we return NoUpdateNeeded from ts.UpdateShardFields, then we don't
// get a ShardInfo back.
default:
resp.Shard = si.Shard
}
View on GitHub (pinned to 01a25a7d17)
Solutions
- Verify existing UIDs via `vtctldclient GetShard <keyspace/shard>` and use a valid UID
- Skip the removal if it already happened — make cleanup scripts idempotent on this error
- Confirm you are targeting the correct shard that owns the SourceShard
Example fix
// before vtctldclient RemoveShardSourceShard merchant/0 --uid 3 # no such uid // after vtctldclient GetShard merchant/0 # inspect source_shards to find valid uids vtctldclient RemoveShardSourceShard merchant/0 --uid 2
Defensive patterns
Strategy: validation
Validate before calling
shard, _ := topoServer.GetShard(ctx, keyspace, shardName)
found := false
for _, ss := range shard.SourceShards { if ss.Uid == uid { found = true } }
if !found { /* nothing to remove; skip */ } Try / catch
try {
client.removeShardSourceShard(keyspace, shard, uid)
} catch (e) {
if (String(e).includes('no SourceShard with uid')) {
// already removed — treat as success for idempotent cleanup
} else { throw e }
} Prevention
- Inspect the shard's source_shards list before removal
- Write cleanup scripts that tolerate already-removed SourceShards
- Confirm target shard is the one holding the UID
- Remove SourceShards only after vreplication streams are fully drained
When it happens
Trigger: Calling `vtctldclient RemoveShardSourceShard` with a `--uid` that was already removed, never added, or typed incorrectly on the target shard.
Common situations: Cleanup scripts running twice (idempotency mismatch); reshard migration already finished and SourceShards were pruned; wrong shard targeted so the UID exists elsewhere.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- %w: uid %v is already in use
- some streams already exist in the target shards, please clea
- shard %v/%v has no primary
- can't get primary tablet record %v: %v
- no vitess cluster found with name %s
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/455c665cec3154b3.
Report an issue: GitHub.