vitessio/vitess · error

DiscoverVTGates(cluster = %s): %w

Error message

DiscoverVTGates(cluster = %s): %w

What it means

VTAdmin's Cluster wraps any failure from the discovery implementation's DiscoverVTGates call with the cluster ID for context. Discovery backends (e.g. vtsql) query the topo to list VTGate servers; if that query fails, this wrap preserves the underlying cause. It is a contextual wrapper, not a distinct failure mode.

Source

Thrown at go/vt/vtadmin/cluster/cluster.go:1158

	resp, err := c.Vtctld.GetCellsAliases(ctx, &vtctldatapb.GetCellsAliasesRequest{})
	if err != nil {
		return nil, err
	}

	return &vtadminpb.ClusterCellsAliases{
		Cluster: c.ToProto(),
		Aliases: resp.Aliases,
	}, nil
}

// GetGates returns the list of all VTGates in the cluster.
func (c *Cluster) GetGates(ctx context.Context) ([]*vtadminpb.VTGate, error) {
	// (TODO|@ajm188) Support tags in the vtadmin RPC request and pass them
	// through here.
	gates, err := c.Discovery.DiscoverVTGates(ctx, []string{})
	if err != nil {
		return nil, fmt.Errorf("DiscoverVTGates(cluster = %s): %w", c.ID, err)
	}

	// This overwrites any Cluster field populated by a particular discovery
	// implementation.
	cpb := c.ToProto()

	for _, g := range gates {
		g.Cluster = cpb
	}

	return gates, nil
}

// GetKeyspace returns a single keyspace in the cluster.
func (c *Cluster) GetKeyspace(ctx context.Context, name string) (*vtadminpb.Keyspace, error) {
	span, ctx := trace.NewSpan(ctx, "Cluster.GetKeyspace")
	defer span.Finish()

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Verify vtadmin's topo/discovery configuration (discovery implementation, addresses, credentials) and test connectivity from the vtadmin host
  2. Check the wrapped cause (the %w error) for the specific topo error and fix that first
  3. Ensure the topo server is running and reachable (etcd/zk health)
  4. Retry GetGates once the topo connection is restored

Example fix

// before
gates, err := c.Discovery.DiscoverVTGates(ctx, []string{})
// after — check discovery config & topo health first, then
if err != nil {
	log.Warn("discover vtgates failed", slog.Any("error", err))
	return nil, fmt.Errorf("DiscoverVTGates(cluster = %s): %w", c.ID, err)
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Go: check connectivity to the topo before calling
if err := pingTopo(ctx, clusterCfg); err != nil {
	return fmt.Errorf("topo unreachable before DiscoverVTGates: %w", err)
}

Try / catch

gates, err := c.GetGates(ctx)
if err != nil {
	if strings.Contains(err.Error(), "DiscoverVTGates(cluster =") {
		// inspect wrapped cause with errors.Unwrap; likely topo/discovery config
		return nil, retryable(err)
	}
	return nil, err
}

Prevention

When it happens

Trigger: Calling cluster.GetGates(ctx) when the discovery backend cannot list gates: topo connection failure, invalid discovery config (e.g. wrong vtctld/vtgate address), or authentication failure against the topo server.

Common situations: vtadmin started before the topo is reachable; misconfigured --topo flags or discovery implementation (vtsql) DSN; network partition between vtadmin and topo; read-only topo credentials lacking permission to list gates.

Related errors


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