vitessio/vitess · error
no SourceShard with uid %v
Error message
no SourceShard with uid %v
What it means
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.
Source
Thrown at go/vt/wrangler/shard.go:181
return wr.ts.DeleteShard(ctx, keyspace, shard)
}
// SourceShardDelete will delete a SourceShard inside a shard, by index.
//
// This takes the keyspace lock as not to interfere with resharding operations.
func (wr *Wrangler) SourceShardDelete(ctx context.Context, keyspace, shard string, uid int32) (err error) {
resp, err := wr.VtctldServer().SourceShardDelete(ctx, &vtctldatapb.SourceShardDeleteRequest{
Keyspace: keyspace,
Shard: shard,
Uid: uid,
})
if err != nil {
return err
}
if resp.Shard == nil {
return fmt.Errorf("no SourceShard with uid %v", uid)
}
return nil
}
// SourceShardAdd will add a new SourceShard inside a shard.
func (wr *Wrangler) SourceShardAdd(ctx context.Context, keyspace, shard string, uid int32, skeyspace, sshard string, keyRange *topodatapb.KeyRange, tables []string) (err error) {
resp, err := wr.VtctldServer().SourceShardAdd(ctx, &vtctldatapb.SourceShardAddRequest{
Keyspace: keyspace,
Shard: shard,
Uid: uid,
SourceKeyspace: skeyspace,
SourceShard: sshard,
KeyRange: keyRange,
Tables: tables,
})
if err != nil {
return errView on GitHub (pinned to 01a25a7d17)
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.
Example fix
// before vtctldclient SourceShardDelete commerce/0 7 // error: no SourceShard with uid 7 // after vtctldclient GetShard commerce/0 # shows source_shards with uid 2 vtctldclient SourceShardDelete commerce/0 2
Defensive patterns
Strategy: validation
Validate before calling
// Before SourceShardDelete, confirm the uid exists
shardInfo, _ := vtctldclientGetShard(keyspace, shard)
found := false
for _, ss := range shardInfo.SourceShards {
if ss.Uid == uid { found = true }
}
if !found {
fmt.Printf("uid %d not present on %s/%s; nothing to delete\n", uid, keyspace, shard)
} Prevention
- 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
When it happens
Trigger: Calling SourceShardDelete (via `vtctldclient SourceShardDelete <keyspace/shard> <uid>`) with a uid that is not present in the shard's SourceShards list.
Common situations: 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).
Related errors
- uid %v is already in use
- shard %v/%v already has SourceShards, not overwriting them (
- shard %v/%v has no source shard
- shard %v/%v has no primary
- can't rebuild serving keyspace while a migration is on going
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/c58ef1de0b722a70.
Report an issue: GitHub.