{"record":{"id":"8ba774a561820f74","repo":"vitessio/vitess","slug":"gettabletsbycell-v-w","errorCode":null,"errorMessage":"GetTabletsByCell(%v): %w","messagePattern":"GetTabletsByCell\\((.+?)\\): %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/topo/helpers/copy.go","lineNumber":126,"sourceCode":"\t\t\t\treturn fmt.Errorf(\"UpdateShardFields(%v, %v): %w\", keyspace, shard, err)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// CopyTablets will create the tablets in the destination topo.\nfunc CopyTablets(ctx context.Context, fromTS, toTS *topo.Server) error {\n\tcells, err := fromTS.GetKnownCells(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"fromTS.GetKnownCells: %w\", err)\n\t}\n\n\tfor _, cell := range cells {\n\t\ttabletAliases, err := fromTS.GetTabletAliasesByCell(ctx, cell)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"GetTabletsByCell(%v): %w\", cell, err)\n\t\t} else {\n\t\t\tfor _, tabletAlias := range tabletAliases {\n\t\t\t\t// read the source tablet\n\t\t\t\tti, err := fromTS.GetTablet(ctx, tabletAlias)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"GetTablet(%v): %w\", tabletAlias, err)\n\t\t\t\t}\n\n\t\t\t\t// try to create the destination\n\t\t\t\terr = toTS.CreateTablet(ctx, ti.Tablet)\n\t\t\t\tif topo.IsErrType(err, topo.NodeExists) {\n\t\t\t\t\t// update the destination tablet\n\t\t\t\t\tlog.Warn(fmt.Sprintf(\"tablet %v already exists, updating it\", tabletAlias))\n\t\t\t\t\t_, err = toTS.UpdateTabletFields(ctx, tabletAlias, func(t *topodatapb.Tablet) error {\n\t\t\t\t\t\tproto.Merge(t, ti.Tablet)\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t})\n\t\t\t\t}","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/topo/helpers/copy.go#L108-L144","documentation":"CopyTablets wraps errors from fromTS.GetTabletAliasesByCell(ctx, cell) with the failing cell name (the message text uses the older GetTabletsByCell name). Cells were listed but enumerating tablet aliases within one cell failed, aborting the copy before any destination write for that cell.","triggerScenarios":"Calling CopyTablets when GetTabletAliasesByCell returns an error: cell missing from the topo (stale cell, NoNode), source topo connection failure, or permission denied on the cell's tablets path.","commonSituations":"A cell was decommissioned but its entry remains; tablet node directories deleted out from under the tool; per-cell topo (local etcd per cell) down while the global topo is up.","solutions":["Check that the named cell exists and its local topo backend is reachable (each cell may have its own topo instance).","If the cell was decommissioned, prune the stale cell entry from the source topo and retry.","If NoNode for the cell's tablets path, remove leftovers or skip the cell.","Retry the copy after the cell's topo instance recovers."],"exampleFix":"// before\ntabletAliases, err := fromTS.GetTabletAliasesByCell(ctx, cell)\nif err != nil {\n\treturn fmt.Errorf(\"GetTabletsByCell(%v): %w\", cell, err)\n} else {\n\tfor _, tabletAlias := range tabletAliases {\n// after\ntabletAliases, err := fromTS.GetTabletAliasesByCell(ctx, cell)\nif err != nil {\n\tif topo.IsErrType(err, topo.NoNode) {\n\t\tlog.Warn(fmt.Sprintf(\"cell %v has no tablets, skipping\", cell))\n\t\tcontinue\n\t}\n\treturn fmt.Errorf(\"GetTabletsByCell(%v): %w\", cell, err)\n}\nfor _, tabletAlias := range tabletAliases {","handlingStrategy":"type-guard","validationCode":"cells, _ := fromTS.GetKnownCells(ctx)\nfor _, c := range cells {\n\tif _, err := fromTS.GetTabletAliasesByCell(ctx, c); err != nil {\n\t\t// stale or unreachable cell; prune or fix before copying\n\t}\n}","typeGuard":"func cellUnavailable(err error) bool {\n\treturn topo.IsErrType(err, topo.NoNode) || topo.IsErrType(err, topo.Unavailable)\n}","tryCatchPattern":"tabletAliases, err := fromTS.GetTabletAliasesByCell(ctx, cell)\nif err != nil {\n\tif topo.IsErrType(err, topo.NoNode) {\n\t\tcontinue\n\t}\n\treturn fmt.Errorf(\"GetTabletsByCell(%v): %w\", cell, err)\n}","preventionTips":["Prune decommissioned cells from the topo before copying tablets.","Ensure per-cell topo instances (local etcd) are up, not just the global one.","Verify the tablets path in each cell with a probe list before batch copy."],"tags":["go","topo","cells"],"backgroundTag":"topo-node-not-found","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}