{"record":{"id":"6a9fae33a9c14d45","repo":"vitessio/vitess","slug":"w-keyspace-s","errorCode":null,"errorMessage":"%w: keyspace %s","messagePattern":"%w: keyspace (.+?)","errorType":"exception","errorClass":"ErrNoSrvVSchema","httpStatus":null,"severity":"error","filePath":"go/vt/vtadmin/api.go","lineNumber":2765,"sourceCode":"\t\tdefer wg.Done()\n\n\t\tspan, ctx := trace.NewSpan(ctx, \"Cluster.GetSrvVSchema\")\n\t\tdefer span.Finish()\n\n\t\tspan.Annotate(\"cell\", tablet.Tablet.Alias.Cell)\n\t\tcluster.AnnotateSpan(c, span)\n\n\t\tres, err := c.Vtctld.GetSrvVSchema(ctx, &vtctldatapb.GetSrvVSchemaRequest{\n\t\t\tCell: tablet.Tablet.Alias.Cell,\n\t\t})\n\t\tif err != nil {\n\t\t\ter.RecordError(fmt.Errorf(\"GetSrvVSchema(%s): %w\", tablet.Tablet.Alias.Cell, err))\n\t\t\treturn\n\t\t}\n\n\t\tksvs, ok := res.SrvVSchema.Keyspaces[req.Keyspace]\n\t\tif !ok {\n\t\t\ter.RecordError(fmt.Errorf(\"%w: keyspace %s\", errors.ErrNoSrvVSchema, req.Keyspace))\n\t\t\treturn\n\t\t}\n\n\t\tksvsb, err := json.Marshal(&ksvs)\n\t\tif err != nil {\n\t\t\ter.RecordError(err)\n\t\t\treturn\n\t\t}\n\n\t\tsrvVSchema = fmt.Sprintf(`{\"%s\": %s}`, req.Keyspace, string(ksvsb))\n\t}(c)\n\n\t// FindAllShardsInKeyspace\n\tgo func(c *cluster.Cluster) {\n\t\tdefer wg.Done()\n\n\t\tshards, err := c.FindAllShardsInKeyspace(ctx, req.Keyspace, cluster.FindAllShardsInKeyspaceOptions{})\n\t\tif err != nil {","sourceCodeStart":2747,"sourceCodeEnd":2783,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtadmin/api.go#L2747-L2783","documentation":"The GetSrvVSchema RPC succeeded, but the returned SrvVSchema contained no entry for the requested keyspace. VTAdmin records errors.ErrNoSrvVSchema wrapped with the keyspace name. This means the keyspace has no deployed (served) vschema in that cell, so vtexplain cannot compute routing for it.","triggerScenarios":"req.Keyspace is absent from res.SrvVSchema.Keyspaces for the tablet's cell — the keyspace was never built/rebuilt into the cell's srv vschema, or the request used a wrong keyspace name.","commonSituations":"Typo in keyspace name in the request; a brand-new keyspace where `RebuildKeyspaceGraph` hasn't run; unmanaged keyspace without a vschema; stale srv vschema after keyspace deletion.","solutions":["Verify the keyspace name is spelled correctly in the request.","Run `vtctldclient RebuildKeyspaceGraph <keyspace>` (or rebuild the cell's srv vschema) so the keyspace appears in the SrvVSchema.","Deploy a vschema for the keyspace (`vtctldclient ApplyVSchema`) if it's a VReplication/VTGate-managed keyspace.","Check with `vtctldclient GetSrvVSchema --cell <cell>` whether the keyspace is present; if stale, rebuild the topo entry.","Confirm the tablet's cell actually serves this keyspace (SrvKeyspace exists for that cell)."],"exampleFix":"// before: keyspace missing from srv vschema\n// after:\nvtctldclient ApplyVSchema --keyspace commerce --vschema '{\"tables\": {}}'\nvtctldclient RebuildKeyspaceGraph --cells zone1 commerce","handlingStrategy":"validation","validationCode":"res, err := vtctldClient.GetSrvVSchema(ctx, &vtctldatapb.GetSrvVSchemaRequest{Cell: cell})\nif err != nil { return err }\nif _, ok := res.SrvVSchema.Keyspaces[keyspace]; !ok {\n    return fmt.Errorf(\"keyspace %s not in cell %s srv vschema; rebuild keyspace graph first\", keyspace, cell)\n}","typeGuard":"func keyspaceInSrvVSchema(svs *vtctldatapb.SrvVSchema, ks string) bool {\n    if svs == nil { return false }\n    _, ok := svs.Keyspaces[ks]\n    return ok\n}","tryCatchPattern":"if _, ok := res.SrvVSchema.Keyspaces[req.Keyspace]; !ok {\n    return vterrors.Errorf(vtrpcpb.Code_FAILED_PRECONDITION, \"keyspace %s has no srv vschema in cell %s; run RebuildKeyspaceGraph\", req.Keyspace, cell)\n}","preventionTips":["After creating a keyspace or applying a vschema, always rebuild the keyspace graph for the serving cells.","Validate keyspace names against topo before issuing vtexplain requests.","Periodically compare SrvVSchema keyspace sets against the topology to detect stale entries."],"tags":["vtadmin","vtexplain","vschema","topology"],"backgroundTag":"no-srv-vschema-for-keyspace","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}