vitessio/vitess · error

fromTS.GetKeyspaces: %w

Error message

fromTS.GetKeyspaces: %w

What it means

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.

Source

Thrown at go/vt/topo/helpers/copy.go:82

			}
			if err := toTS.SaveVSchema(ctx, ksvs); err != nil {
				log.Error(fmt.Sprintf("SaveVSchema(%v): %v", keyspace, err))
			}
		case topo.IsErrType(err, topo.NoNode):
			// Nothing to do.
		default:
			log.Error(fmt.Sprintf("GetVSchema(%v): %v", keyspace, err))
		}
	}

	return nil
}

// CopyShards will create the shards in the destination topo.
func CopyShards(ctx context.Context, fromTS, toTS *topo.Server) error {
	keyspaces, err := fromTS.GetKeyspaces(ctx)
	if err != nil {
		return fmt.Errorf("fromTS.GetKeyspaces: %w", err)
	}

	for _, keyspace := range keyspaces {
		shards, err := fromTS.GetShardNames(ctx, keyspace)
		if err != nil {
			return fmt.Errorf("GetShardNames(%v): %w", keyspace, err)
		}

		for _, shard := range shards {
			si, err := fromTS.GetShard(ctx, keyspace, shard)
			if err != nil {
				return fmt.Errorf("GetShard(%v, %v): %w", keyspace, shard, err)
			}

			if err := toTS.CreateShard(ctx, keyspace, shard); err != nil {
				if topo.IsErrType(err, topo.NodeExists) {
					log.Warn(fmt.Sprintf("shard %v/%v already exists", keyspace, shard))
				} else {

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Confirm the source topo server address and that the backend (etcd/zk) is healthy.
  2. Increase the context deadline and retry the copy.
  3. Check network/firewall between the client and the topo backend.
  4. Read the wrapped cause to distinguish connection vs permission vs data errors.

Example fix

// before
keyspaces, err := fromTS.GetKeyspaces(ctx)
if err != nil {
	return fmt.Errorf("fromTS.GetKeyspaces: %w", err)
}
// after
keyspaces, err := fromTS.GetKeyspaces(ctx)
if err != nil {
	return vterrors.Wrapf(err, vtrpcpb.Code_INTERNAL, "fromTS.GetKeyspaces")
}
Defensive patterns

Strategy: retry

Validate before calling

if _, err := fromTS.GetKeyspaces(ctx); err != nil {
	return fmt.Errorf("source topo unreachable: %w", err)
}

Try / catch

keyspaces, err := fromTS.GetKeyspaces(ctx)
if err != nil {
	if errors.Is(err, context.DeadlineExceeded) {
		// retry with a longer deadline
	}
	return fmt.Errorf("fromTS.GetKeyspaces: %w", err)
}

Prevention

When it happens

Trigger: Calling topo/helpers.CopyShards(ctx, fromTS, toTS) when the source topo listing call fails: unreachable topo server, canceled context, or global-cell read failure.

Common situations: 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.

Related errors


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/55b935de7ec15cda. Report an issue: GitHub.