vitessio/vitess · error
SrvVSchema has no entry for keyspace %v
Error message
SrvVSchema has no entry for keyspace %v
What it means
The V3 keyspace-id resolver fetches the SrvVSchema for the cell and looks up the streaming keyspace's schema entry. If the keyspace is absent from the cell's SrvVSchema there is no vschema to resolve vindexes, so streaming a keyrange cannot proceed.
Source
Thrown at go/vt/binlog/keyspace_id_resolver.go:63
// field, returns the keyspace id.
type keyspaceIDResolverFactory func(*schema.Table) (int, keyspaceIDResolver, error)
// newKeyspaceIDResolverFactory creates a new
// keyspaceIDResolverFactory for the provided keyspace and cell.
func newKeyspaceIDResolverFactory(ctx context.Context, ts *topo.Server, keyspace string, cell string, parser *sqlparser.Parser) (keyspaceIDResolverFactory, error) {
return newKeyspaceIDResolverFactoryV3(ctx, ts, keyspace, cell, parser)
}
// newKeyspaceIDResolverFactoryV3 finds the SrvVSchema in the cell,
// gets the keyspace part, and uses it to find the column name.
func newKeyspaceIDResolverFactoryV3(ctx context.Context, ts *topo.Server, keyspace string, cell string, parser *sqlparser.Parser) (keyspaceIDResolverFactory, error) {
srvVSchema, err := ts.GetSrvVSchema(ctx, cell)
if err != nil {
return nil, err
}
kschema, ok := srvVSchema.Keyspaces[keyspace]
if !ok {
return nil, fmt.Errorf("SrvVSchema has no entry for keyspace %v", keyspace)
}
keyspaceSchema, err := vindexes.BuildKeyspaceSchema(kschema, keyspace, parser)
if err != nil {
return nil, fmt.Errorf("cannot build vschema for keyspace %v: %v", keyspace, err)
}
return func(table *schema.Table) (int, keyspaceIDResolver, error) {
// Find the v3 schema.
tableSchema, ok := keyspaceSchema.Tables[table.Name.String()]
if !ok {
return -1, nil, fmt.Errorf("no vschema definition for table %v", table.Name)
}
// use the lowest cost unique vindex as the sharding key
colVindex, err := vindexes.FindVindexForSharding(table.Name.String(), tableSchema.ColumnVindexes)
if err != nil {
return -1, nil, err
}
View on GitHub (pinned to 01a25a7d17)
Solutions
- Rebuild the SrvVSchema: vtctldclient RebuildKeyspaceGraph --cells=<cell> <keyspace>.
- Verify the keyspace name matches the one in the topo (no typos).
- Check the topo (vtctl GetSrvVSchema <cell>) to confirm the keyspace entry exists.
Example fix
// before vtctldclient GetSrvVSchema --cell=zone1 // keyspace 'commrce' missing // after echo 'ks: "commerce" typo -> fix name or rebuild' vtctldclient RebuildKeyspaceGraph --cells=zone1 commerce
Defensive patterns
Strategy: validation
Validate before calling
srv, err := ts.GetSrvVSchema(ctx, cell)
if err != nil { return err }
if _, ok := srv.Keyspaces[keyspace]; !ok {
return fmt.Errorf("keyspace %s missing from SrvVSchema in cell %s", keyspace, cell)
} Try / catch
if err := updateStream.StreamKeyRange(ctx, keyrange, timestamp, cb); err != nil {
if strings.Contains(err.Error(), "SrvVSchema has no entry") {
// run: vtctldclient RebuildKeyspaceGraph --cells=<cell> <keyspace>
}
return err
} Prevention
- Run RebuildKeyspaceGraph after every keyspace/vschema change.
- Double-check keyspace spelling against the topo before streaming.
- Verify SrvVSchema exists per-cell, not just globally.
When it happens
Trigger: Calling UpdateStream.StreamKeyRange when ts.GetSrvVSchema(ctx, cell) succeeds but srvVSchema.Keyspaces[keyspace] is missing — i.e. no SrvVSchema record for that keyspace in that cell.
Common situations: Stale or missing SrvVSchema in the topo (rebuild not run); typo in keyspace name; streaming keyrange in a keyspace that was never rebuilt vschema for in this cell.
Related errors
- GetVSchema(%s) failed: %v
- cannot build vschema for keyspace %v: %v
- no vschema definition for table %v
- cannot find column %v in table %v
- GetKnownCells failed: %v
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/bab76cdd4ba6f2d9.
Report an issue: GitHub.