vitessio/vitess · error
GetKnownCells failed: %v
Error message
GetKnownCells failed: %v
What it means
RebuildSrvVSchema reconstructs the SrvVSchema object stored in every cell. When the caller passes an empty cells list, the code asks the topology for the list of known cells via GetKnownCells; this error is thrown if that topology read fails. It means the rebuild could not even determine which cells to write to, so no SrvVSchema was updated.
Source
Thrown at go/vt/topo/srv_vschema.go:152
func (ts *Server) DeleteSrvVSchema(ctx context.Context, cell string) error {
conn, err := ts.ConnForCell(ctx, cell)
if err != nil {
return err
}
nodePath := SrvVSchemaFile
return conn.Delete(ctx, nodePath, nil)
}
// RebuildSrvVSchema rebuilds the SrvVSchema for the provided cell list
// (or all cells if cell list is empty).
func (ts *Server) RebuildSrvVSchema(ctx context.Context, cells []string) error {
// get the actual list of cells
if len(cells) == 0 {
var err error
cells, err = ts.GetKnownCells(ctx)
if err != nil {
return fmt.Errorf("GetKnownCells failed: %v", err)
}
}
// get the keyspaces
keyspaces, err := ts.GetKeyspaces(ctx)
if err != nil {
return fmt.Errorf("GetKeyspaces failed: %v", err)
}
// build the SrvVSchema in parallel, protected by mu
wg := sync.WaitGroup{}
mu := sync.Mutex{}
var finalErr error
srvVSchema := &vschemapb.SrvVSchema{
Keyspaces: map[string]*vschemapb.Keyspace{},
}
for _, keyspace := range keyspaces {
wg.Add(1)View on GitHub (pinned to 01a25a7d17)
Solutions
- Check topo server connectivity from the calling process (e.g. `vtctldclient GetCellsInfo` or etcdctl/zkCli against the same endpoints) and fix the topo flags or backend outage first.
- Ensure cells are registered in the topo (`vtctldclient AddCellInfo`) — GetKnownCells fails if it cannot read /cells.
- Retry the rebuild once the topo is reachable; RebuildSrvVSchema is idempotent.
- If calling programmatically, pass an explicit non-empty cells slice to skip the GetKnownCells call entirely.
Example fix
// before
err := ts.RebuildSrvVSchema(ctx, nil) // fails while topo cells unreadable
// after (only once topo is healthy)
if err := ts.RebuildSrvVSchema(ctx, []string{"zone1", "zone2"}); err != nil {
return err
} Defensive patterns
Strategy: retry
Validate before calling
// Check topo reachability before rebuilding
if _, err := ts.GetKnownCells(ctx); err != nil {
return fmt.Errorf("topo unavailable, skipping rebuild: %w", err)
} Try / catch
err := ts.RebuildSrvVSchema(ctx, cells)
if err != nil && strings.Contains(err.Error(), "GetKnownCells failed") {
// back off and retry once topo recovers
time.Sleep(retryDelay)
err = ts.RebuildSrvVSchema(ctx, cells)
} Prevention
- Monitor topo backend (etcd/zk) health and alert on it.
- Pass an explicit cells list when you already know the cells to skip GetKnownCells.
- Register cells with AddCellInfo as part of cluster bootstrap.
- Use generous context timeouts for topo-heavy rebuilds.
When it happens
Trigger: Calling RebuildSrvVSchema(ctx, nil) (or ApplyRoutingRules/ApplyShardRoutingRules/InitRoutingRules etc., which delegate with no cells) while the topo server is unreachable, has no cells registered, or the context is cancelled/timed out.
Common situations: etcd/zk/consul outage or wrong topo flags (--topo_implementation, --topo_server_addr) on vtctld; topo cells never created after a fresh install; network partition between vtctld and the topo store; permissions/auth failure against the topo backend.
Related errors
- GetKeyspaces failed: %v
- SrvVSchema has no entry for keyspace %v
- GetTabletsByCell(%v): %w
- GetCellInfoNames(): %w
- GetRoutingRules failed: %v
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/99d8b389425e1ff5.
Report an issue: GitHub.