vitessio/vitess · error

GetSrvKeyspaces(keyspace = %s): %w

Error message

GetSrvKeyspaces(keyspace = %s): %w

What it means

Inside Cluster.GetSrvKeyspaces, each keyspace's srv-keyspace lookup runs in a goroutine; individual failures are recorded (not returned) via a concurrency.AllErrorRecorder with the keyspace name attached. The overall call still returns other keyspaces' results plus a combined error.

Source

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

	if err != nil {
		return nil, fmt.Errorf("GetKeyspaces(cluster = %s): %w", c.ID, err)
	}

	var (
		m            sync.Mutex
		wg           sync.WaitGroup
		rec          concurrency.AllErrorRecorder
		srvKeyspaces = make(map[string]*vtctldatapb.GetSrvKeyspacesResponse, len(keyspaces.Keyspaces))
	)

	for _, keyspace := range keyspaces.Keyspaces {
		wg.Add(1)

		go func(keyspace *vtctldatapb.Keyspace) {
			defer wg.Done()
			srv_keyspaces, err := c.Vtctld.GetSrvKeyspaces(ctx, &vtctldatapb.GetSrvKeyspacesRequest{Keyspace: keyspace.Name, Cells: cells})
			if err != nil {
				rec.RecordError(fmt.Errorf("GetSrvKeyspaces(keyspace = %s): %w", keyspace.Name, err))
				return
			}

			m.Lock()
			srvKeyspaces[keyspace.Name] = srv_keyspaces
			m.Unlock()
		}(keyspace)
	}

	wg.Wait()

	if rec.HasErrors() {
		return nil, rec.Error()
	}

	return srvKeyspaces, nil
}

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Call GetSrvKeyspaces again — the error is recorded per-keyspace, so partial/transient failures often succeed on retry
  2. Check vtctld and per-cell topo health for the failing keyspace's cells
  3. Look at rec.Errors() for the full set of failed keyspaces, not just the first
  4. Narrow the cells filter if a specific cell's topo is unhealthy
Defensive patterns

Strategy: retry

Try / catch

srv, err := c.GetSrvKeyspaces(ctx, req)
if err != nil {
	// err aggregates per-keyspace errors; parse keyspace names from messages
	// and retry only the failed keyspaces
	var aggr interface{ Errors() []error }
	if errors.As(err, &aggr) {
		for _, e := range aggr.Errors() { /* retry per keyspace */ }
	}
}

Prevention

When it happens

Trigger: Any per-keyspace Vtctld.GetSrvKeyspaces RPC failure — vtctld error, topo read failure, or context cancellation for that shard of work while fanning out over all keyspaces in parallel.

Common situations: Partial topo outage affecting some cells (Cells filter); transient vtctld overload during the parallel fan-out; a keyspace being deleted concurrently so its srv-keyspace entry vanishes mid-scan.

Related errors


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