{"record":{"id":"c1e2c9bf79e1711d","repo":"vitessio/vitess","slug":"getshardreplication-v-v-v-w","errorCode":null,"errorMessage":"GetShardReplication(%v, %v, %v): %w","messagePattern":"GetShardReplication\\((.+?), (.+?), (.+?)\\): %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/topo/helpers/copy.go","lineNumber":178,"sourceCode":"\t\treturn fmt.Errorf(\"fromTS.GetKeyspaces: %w\", err)\n\t}\n\n\tcells, err := fromTS.GetCellInfoNames(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"GetCellInfoNames(): %w\", err)\n\t}\n\n\tfor _, keyspace := range keyspaces {\n\t\tshards, err := fromTS.GetShardNames(ctx, keyspace)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"GetShardNames(%v): %w\", keyspace, err)\n\t\t}\n\n\t\tfor _, shard := range shards {\n\t\t\tfor _, cell := range cells {\n\t\t\t\tsri, err := fromTS.GetShardReplication(ctx, cell, keyspace, shard)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"GetShardReplication(%v, %v, %v): %w\", cell, keyspace, shard, err)\n\t\t\t\t}\n\n\t\t\t\tsriNodes := map[string]struct{}{}\n\t\t\t\tfor _, node := range sri.Nodes {\n\t\t\t\t\tsriNodes[topoproto.TabletAliasString(node.TabletAlias)] = struct{}{}\n\t\t\t\t}\n\n\t\t\t\tif err := toTS.UpdateShardReplicationFields(ctx, cell, keyspace, shard, func(oldSR *topodatapb.ShardReplication) error {\n\t\t\t\t\tvar nodes []*topodatapb.ShardReplication_Node\n\t\t\t\t\tfor _, oldNode := range oldSR.Nodes {\n\t\t\t\t\t\tif _, ok := sriNodes[topoproto.TabletAliasString(oldNode.TabletAlias)]; ok {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tnodes = append(nodes, oldNode)\n\t\t\t\t\t}\n\n\t\t\t\t\tnodes = append(nodes, sri.Nodes...)","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/topo/helpers/copy.go#L160-L196","documentation":"CopyShardReplications reads each ShardReplication object from the source topo per (cell, keyspace, shard) with fromTS.GetShardReplication. This error wraps that read failure and identifies the exact cell/keyspace/shard triple.","triggerScenarios":"Calling CopyShardReplications when fromTS.GetShardReplication fails: the ShardReplication node does not exist in that cell, ctx cancellation, or a source topo backend error.","commonSituations":"A shard exists but its ShardReplication node was never created in some cell (e.g. tablet placed without replication record); concurrent topo surgery; transient backend timeouts.","solutions":["Check whether the ShardReplication node legitimately should exist for that cell/keyspace/shard; skip or create it as appropriate","Ignore expected topo.NoNode cases if the copy tolerates missing replication records","Verify source topo health and retry the copy","Rebuild the ShardReplication record in the source (e.g. via tablet repair / RefreshState)"],"exampleFix":"// before\nsri, err := fromTS.GetShardReplication(ctx, cell, keyspace, shard)\nif err != nil {\n    return fmt.Errorf(\"GetShardReplication(%v, %v, %v): %w\", cell, keyspace, shard, err)\n}\n// after\nsri, err := fromTS.GetShardReplication(ctx, cell, keyspace, shard)\nif topo.IsErrType(err, topo.NoNode) {\n    continue // no replication record in this cell\n} else if err != nil {\n    return fmt.Errorf(\"GetShardReplication(%v, %v, %v): %w\", cell, keyspace, shard, err)\n}","handlingStrategy":"type-guard","validationCode":"_, err := fromTS.GetShardReplication(ctx, cell, keyspace, shard)\nif topo.IsErrType(err, topo.NoNode) {\n    log.Warnf(\"no ShardReplication node in cell %s\", cell)\n}","typeGuard":"func isNoNode(err error) bool { return topo.IsErrType(err, topo.NoNode) }","tryCatchPattern":"err := helpers.CopyShardReplications(ctx, fromTS, toTS)\nvar missing topo.ErrNoNode\nif err != nil && strings.Contains(err.Error(), \"GetShardReplication\") {\n    log.Errorf(\"shard replication node missing: %v\", err)\n} else if err != nil {\n    return err\n}","preventionTips":["Ensure every tablet placement has a corresponding ShardReplication record","Run topo consistency checks before copying","Treat missing replication records for empty cells as expected and skip them"],"tags":["topo","shard-replication","source-topo"],"backgroundTag":"topo-node-read-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}