{"record":{"id":"99d8b389425e1ff5","repo":"vitessio/vitess","slug":"getknowncells-failed-v","errorCode":null,"errorMessage":"GetKnownCells failed: %v","messagePattern":"GetKnownCells failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/topo/srv_vschema.go","lineNumber":152,"sourceCode":"func (ts *Server) DeleteSrvVSchema(ctx context.Context, cell string) error {\n\tconn, err := ts.ConnForCell(ctx, cell)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnodePath := SrvVSchemaFile\n\treturn conn.Delete(ctx, nodePath, nil)\n}\n\n// RebuildSrvVSchema rebuilds the SrvVSchema for the provided cell list\n// (or all cells if cell list is empty).\nfunc (ts *Server) RebuildSrvVSchema(ctx context.Context, cells []string) error {\n\t// get the actual list of cells\n\tif len(cells) == 0 {\n\t\tvar err error\n\t\tcells, err = ts.GetKnownCells(ctx)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"GetKnownCells failed: %v\", err)\n\t\t}\n\t}\n\n\t// get the keyspaces\n\tkeyspaces, err := ts.GetKeyspaces(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"GetKeyspaces failed: %v\", err)\n\t}\n\n\t// build the SrvVSchema in parallel, protected by mu\n\twg := sync.WaitGroup{}\n\tmu := sync.Mutex{}\n\tvar finalErr error\n\tsrvVSchema := &vschemapb.SrvVSchema{\n\t\tKeyspaces: map[string]*vschemapb.Keyspace{},\n\t}\n\tfor _, keyspace := range keyspaces {\n\t\twg.Add(1)","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/topo/srv_vschema.go#L134-L170","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nerr := ts.RebuildSrvVSchema(ctx, nil) // fails while topo cells unreadable\n// after (only once topo is healthy)\nif err := ts.RebuildSrvVSchema(ctx, []string{\"zone1\", \"zone2\"}); err != nil {\n    return err\n}","handlingStrategy":"retry","validationCode":"// Check topo reachability before rebuilding\nif _, err := ts.GetKnownCells(ctx); err != nil {\n    return fmt.Errorf(\"topo unavailable, skipping rebuild: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"err := ts.RebuildSrvVSchema(ctx, cells)\nif err != nil && strings.Contains(err.Error(), \"GetKnownCells failed\") {\n    // back off and retry once topo recovers\n    time.Sleep(retryDelay)\n    err = ts.RebuildSrvVSchema(ctx, cells)\n}","preventionTips":["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."],"tags":["topo","vschema","cells","connectivity"],"backgroundTag":"topo-unavailable","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}