{"record":{"id":"bab76cdd4ba6f2d9","repo":"vitessio/vitess","slug":"srvvschema-has-no-entry-for-keyspace-v","errorCode":null,"errorMessage":"SrvVSchema has no entry for keyspace %v","messagePattern":"SrvVSchema has no entry for keyspace (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/binlog/keyspace_id_resolver.go","lineNumber":63,"sourceCode":"// field, returns the keyspace id.\ntype keyspaceIDResolverFactory func(*schema.Table) (int, keyspaceIDResolver, error)\n\n// newKeyspaceIDResolverFactory creates a new\n// keyspaceIDResolverFactory for the provided keyspace and cell.\nfunc newKeyspaceIDResolverFactory(ctx context.Context, ts *topo.Server, keyspace string, cell string, parser *sqlparser.Parser) (keyspaceIDResolverFactory, error) {\n\treturn newKeyspaceIDResolverFactoryV3(ctx, ts, keyspace, cell, parser)\n}\n\n// newKeyspaceIDResolverFactoryV3 finds the SrvVSchema in the cell,\n// gets the keyspace part, and uses it to find the column name.\nfunc newKeyspaceIDResolverFactoryV3(ctx context.Context, ts *topo.Server, keyspace string, cell string, parser *sqlparser.Parser) (keyspaceIDResolverFactory, error) {\n\tsrvVSchema, err := ts.GetSrvVSchema(ctx, cell)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tkschema, ok := srvVSchema.Keyspaces[keyspace]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"SrvVSchema has no entry for keyspace %v\", keyspace)\n\t}\n\tkeyspaceSchema, err := vindexes.BuildKeyspaceSchema(kschema, keyspace, parser)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot build vschema for keyspace %v: %v\", keyspace, err)\n\t}\n\treturn func(table *schema.Table) (int, keyspaceIDResolver, error) {\n\t\t// Find the v3 schema.\n\t\ttableSchema, ok := keyspaceSchema.Tables[table.Name.String()]\n\t\tif !ok {\n\t\t\treturn -1, nil, fmt.Errorf(\"no vschema definition for table %v\", table.Name)\n\t\t}\n\n\t\t// use the lowest cost unique vindex as the sharding key\n\t\tcolVindex, err := vindexes.FindVindexForSharding(table.Name.String(), tableSchema.ColumnVindexes)\n\t\tif err != nil {\n\t\t\treturn -1, nil, err\n\t\t}\n","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/binlog/keyspace_id_resolver.go#L45-L81","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nvtctldclient GetSrvVSchema --cell=zone1  // keyspace 'commrce' missing\n// after\necho 'ks: \"commerce\" typo -> fix name or rebuild'\nvtctldclient RebuildKeyspaceGraph --cells=zone1 commerce","handlingStrategy":"validation","validationCode":"srv, err := ts.GetSrvVSchema(ctx, cell)\nif err != nil { return err }\nif _, ok := srv.Keyspaces[keyspace]; !ok {\n\treturn fmt.Errorf(\"keyspace %s missing from SrvVSchema in cell %s\", keyspace, cell)\n}","typeGuard":null,"tryCatchPattern":"if err := updateStream.StreamKeyRange(ctx, keyrange, timestamp, cb); err != nil {\n\tif strings.Contains(err.Error(), \"SrvVSchema has no entry\") {\n\t\t// run: vtctldclient RebuildKeyspaceGraph --cells=<cell> <keyspace>\n\t}\n\treturn err\n}","preventionTips":["Run RebuildKeyspaceGraph after every keyspace/vschema change.","Double-check keyspace spelling against the topo before streaming.","Verify SrvVSchema exists per-cell, not just globally."],"tags":["topo","vschema","keyspace","binlog"],"backgroundTag":"srvvschema-keyspace-missing","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}