{"record":{"id":"55b935de7ec15cda","repo":"vitessio/vitess","slug":"fromts-getkeyspaces-w","errorCode":null,"errorMessage":"fromTS.GetKeyspaces: %w","messagePattern":"fromTS\\.GetKeyspaces: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/topo/helpers/copy.go","lineNumber":82,"sourceCode":"\t\t\t}\n\t\t\tif err := toTS.SaveVSchema(ctx, ksvs); err != nil {\n\t\t\t\tlog.Error(fmt.Sprintf(\"SaveVSchema(%v): %v\", keyspace, err))\n\t\t\t}\n\t\tcase topo.IsErrType(err, topo.NoNode):\n\t\t\t// Nothing to do.\n\t\tdefault:\n\t\t\tlog.Error(fmt.Sprintf(\"GetVSchema(%v): %v\", keyspace, err))\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// CopyShards will create the shards in the destination topo.\nfunc CopyShards(ctx context.Context, fromTS, toTS *topo.Server) error {\n\tkeyspaces, err := fromTS.GetKeyspaces(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"fromTS.GetKeyspaces: %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\tsi, err := fromTS.GetShard(ctx, keyspace, shard)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"GetShard(%v, %v): %w\", keyspace, shard, err)\n\t\t\t}\n\n\t\t\tif err := toTS.CreateShard(ctx, keyspace, shard); err != nil {\n\t\t\t\tif topo.IsErrType(err, topo.NodeExists) {\n\t\t\t\t\tlog.Warn(fmt.Sprintf(\"shard %v/%v already exists\", keyspace, shard))\n\t\t\t\t} else {","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/topo/helpers/copy.go#L64-L100","documentation":"CopyShards wraps errors from fromTS.GetKeyspaces(ctx) with a 'fromTS.GetKeyspaces: ' prefix. This means the initial listing of keyspaces on the source topo failed, so no shards can be enumerated and the copy aborts immediately.","triggerScenarios":"Calling topo/helpers.CopyShards(ctx, fromTS, toTS) when the source topo listing call fails: unreachable topo server, canceled context, or global-cell read failure.","commonSituations":"Misconfigured source topo backend in copy tooling; etcd/zookeeper outage; expired context in long-running migration scripts; DNS or network failures between the tool and the topo cluster.","solutions":["Confirm the source topo server address and that the backend (etcd/zk) is healthy.","Increase the context deadline and retry the copy.","Check network/firewall between the client and the topo backend.","Read the wrapped cause to distinguish connection vs permission vs data errors."],"exampleFix":"// before\nkeyspaces, err := fromTS.GetKeyspaces(ctx)\nif err != nil {\n\treturn fmt.Errorf(\"fromTS.GetKeyspaces: %w\", err)\n}\n// after\nkeyspaces, err := fromTS.GetKeyspaces(ctx)\nif err != nil {\n\treturn vterrors.Wrapf(err, vtrpcpb.Code_INTERNAL, \"fromTS.GetKeyspaces\")\n}","handlingStrategy":"retry","validationCode":"if _, err := fromTS.GetKeyspaces(ctx); err != nil {\n\treturn fmt.Errorf(\"source topo unreachable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"keyspaces, err := fromTS.GetKeyspaces(ctx)\nif err != nil {\n\tif errors.Is(err, context.DeadlineExceeded) {\n\t\t// retry with a longer deadline\n\t}\n\treturn fmt.Errorf(\"fromTS.GetKeyspaces: %w\", err)\n}","preventionTips":["Validate source topo connectivity before starting CopyShards.","Use bounded but generous context deadlines.","Verify topo flags point at the correct source cluster."],"tags":["go","topo","network"],"backgroundTag":"topo-server-unreachable","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}