{"record":{"id":"c58ef1de0b722a70","repo":"vitessio/vitess","slug":"no-sourceshard-with-uid-v","errorCode":null,"errorMessage":"no SourceShard with uid %v","messagePattern":"no SourceShard with uid (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/wrangler/shard.go","lineNumber":181,"sourceCode":"\n\treturn wr.ts.DeleteShard(ctx, keyspace, shard)\n}\n\n// SourceShardDelete will delete a SourceShard inside a shard, by index.\n//\n// This takes the keyspace lock as not to interfere with resharding operations.\nfunc (wr *Wrangler) SourceShardDelete(ctx context.Context, keyspace, shard string, uid int32) (err error) {\n\tresp, err := wr.VtctldServer().SourceShardDelete(ctx, &vtctldatapb.SourceShardDeleteRequest{\n\t\tKeyspace: keyspace,\n\t\tShard:    shard,\n\t\tUid:      uid,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif resp.Shard == nil {\n\t\treturn fmt.Errorf(\"no SourceShard with uid %v\", uid)\n\t}\n\n\treturn nil\n}\n\n// SourceShardAdd will add a new SourceShard inside a shard.\nfunc (wr *Wrangler) SourceShardAdd(ctx context.Context, keyspace, shard string, uid int32, skeyspace, sshard string, keyRange *topodatapb.KeyRange, tables []string) (err error) {\n\tresp, err := wr.VtctldServer().SourceShardAdd(ctx, &vtctldatapb.SourceShardAddRequest{\n\t\tKeyspace:       keyspace,\n\t\tShard:          shard,\n\t\tUid:            uid,\n\t\tSourceKeyspace: skeyspace,\n\t\tSourceShard:    sshard,\n\t\tKeyRange:       keyRange,\n\t\tTables:         tables,\n\t})\n\tif err != nil {\n\t\treturn err","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/wrangler/shard.go#L163-L199","documentation":"SourceShardDelete asks the topo to remove the SourceShard entry with the given uid from the shard record. If after the update the shard record reports no matching SourceShard, it means no source shard with that uid existed on the shard.","triggerScenarios":"Calling SourceShardDelete (via `vtctldclient SourceShardDelete <keyspace/shard> <uid>`) with a uid that is not present in the shard's SourceShards list.","commonSituations":"Typo in the uid; the migration/reshard workflow that owned that source shard already finished and removed it; running the command twice (second run finds nothing).","solutions":["Run `vtctldclient GetShard <keyspace>/<shard>` and inspect the source_shards list for valid uids.","Re-run with the correct uid.","If the source shard is already gone, the operation is effectively complete — no action needed."],"exampleFix":"// before\nvtctldclient SourceShardDelete commerce/0 7\n// error: no SourceShard with uid 7\n// after\nvtctldclient GetShard commerce/0      # shows source_shards with uid 2\nvtctldclient SourceShardDelete commerce/0 2","handlingStrategy":"validation","validationCode":"// Before SourceShardDelete, confirm the uid exists\nshardInfo, _ := vtctldclientGetShard(keyspace, shard)\nfound := false\nfor _, ss := range shardInfo.SourceShards {\n    if ss.Uid == uid { found = true }\n}\nif !found {\n    fmt.Printf(\"uid %d not present on %s/%s; nothing to delete\\n\", uid, keyspace, shard)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Read `GetShard` output to confirm source_shard uids before deleting","Treat \"no SourceShard\" on a repeat call as success in idempotent automation","Avoid hardcoding uids in scripts; derive them from the shard record"],"tags":["topo","resharding","source-shard","filtered-replication"],"backgroundTag":"source-shard-uid-not-found","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}