{"record":{"id":"455c665cec3154b3","repo":"vitessio/vitess","slug":"w-no-sourceshard-with-uid-v","errorCode":null,"errorMessage":"%w: no SourceShard with uid %v","messagePattern":"%w: no SourceShard with uid (.+?)","errorType":"exception","errorClass":"topo.NewError(topo.NoUpdateNeeded)","httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/grpcvtctldserver/server.go","lineNumber":4415,"sourceCode":"\tvar si *topo.ShardInfo\n\n\tctx, unlock, lockErr := s.ts.LockKeyspace(ctx, req.Keyspace, fmt.Sprintf(\"SourceShardDelete(%v)\", req.Uid))\n\tif lockErr != nil {\n\t\terr = lockErr\n\t\treturn nil, err\n\t}\n\tdefer unlock(&err)\n\n\tsi, err = s.ts.UpdateShardFields(ctx, req.Keyspace, req.Shard, func(si *topo.ShardInfo) error {\n\t\tvar newSourceShards []*topodatapb.Shard_SourceShard\n\t\tfor _, ss := range si.SourceShards {\n\t\t\tif ss.Uid != req.Uid {\n\t\t\t\tnewSourceShards = append(newSourceShards, ss)\n\t\t\t}\n\t\t}\n\n\t\tif len(newSourceShards) == len(si.SourceShards) {\n\t\t\treturn fmt.Errorf(\"%w: no SourceShard with uid %v\", topo.NewError(topo.NoUpdateNeeded, fmt.Sprintf(\"%s/%s\", req.Keyspace, req.Shard)), req.Uid)\n\t\t}\n\n\t\tsi.SourceShards = newSourceShards\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp = &vtctldatapb.SourceShardDeleteResponse{}\n\tswitch si {\n\tcase nil:\n\t\t// If we return NoUpdateNeeded from ts.UpdateShardFields, then we don't\n\t\t// get a ShardInfo back.\n\tdefault:\n\t\tresp.Shard = si.Shard\n\t}\n","sourceCodeStart":4397,"sourceCodeEnd":4433,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/grpcvtctldserver/server.go#L4397-L4433","documentation":"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.","triggerScenarios":"Calling `vtctldclient RemoveShardSourceShard` with a `--uid` that was already removed, never added, or typed incorrectly on the target shard.","commonSituations":"Cleanup scripts running twice (idempotency mismatch); reshard migration already finished and SourceShards were pruned; wrong shard targeted so the UID exists elsewhere.","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"],"exampleFix":"// before\nvtctldclient RemoveShardSourceShard merchant/0 --uid 3  # no such uid\n// after\nvtctldclient GetShard merchant/0   # inspect source_shards to find valid uids\nvtctldclient RemoveShardSourceShard merchant/0 --uid 2","handlingStrategy":"validation","validationCode":"shard, _ := topoServer.GetShard(ctx, keyspace, shardName)\nfound := false\nfor _, ss := range shard.SourceShards { if ss.Uid == uid { found = true } }\nif !found { /* nothing to remove; skip */ }","typeGuard":null,"tryCatchPattern":"try {\n  client.removeShardSourceShard(keyspace, shard, uid)\n} catch (e) {\n  if (String(e).includes('no SourceShard with uid')) {\n    // already removed — treat as success for idempotent cleanup\n  } else { throw e }\n}","preventionTips":["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"],"tags":["vreplication","shard","resharding","topo"],"backgroundTag":"resource-not-found","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}