{"record":{"id":"d559142acece31c3","repo":"vitessio/vitess","slug":"table-s-not-found-in-vschema-for-keyspace-s-d55914","errorCode":null,"errorMessage":"table %s not found in vschema for keyspace %s","messagePattern":"table (.+?) not found in vschema for keyspace (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/wrangler/materializer.go","lineNumber":1065,"sourceCode":"\t\treturn err\n\t}\n\treturn mz.startStreams(ctx)\n}\n\nfunc (wr *Wrangler) buildMaterializer(ctx context.Context, ms *vtctldatapb.MaterializeSettings) (*materializer, error) {\n\tvschema, err := wr.ts.GetVSchema(ctx, ms.TargetKeyspace)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttargetVSchema, err := vindexes.BuildKeyspaceSchema(vschema.Keyspace, ms.TargetKeyspace, wr.env.Parser())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif targetVSchema.Keyspace.Sharded {\n\t\tfor _, ts := range ms.TableSettings {\n\t\t\tif targetVSchema.Tables[ts.TargetTable] == nil {\n\t\t\t\treturn nil, fmt.Errorf(\"table %s not found in vschema for keyspace %s\", ts.TargetTable, ms.TargetKeyspace)\n\t\t\t}\n\t\t}\n\t}\n\tisPartial := false\n\tsourceShards, err := wr.sourceTs.GetServingShards(ctx, ms.SourceKeyspace)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(ms.SourceShards) > 0 {\n\t\tisPartial = true\n\t\tvar sourceShards2 []*topo.ShardInfo\n\t\tfor _, shard := range sourceShards {\n\t\t\tif slices.Contains(ms.SourceShards, shard.ShardName()) {\n\t\t\t\tsourceShards2 = append(sourceShards2, shard)\n\t\t\t}\n\t\t}\n\t\tsourceShards = sourceShards2\n\t}","sourceCodeStart":1047,"sourceCodeEnd":1083,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/wrangler/materializer.go#L1047-L1083","documentation":"buildMaterializer validates that every TableSettings.TargetTable exists in the target keyspace's VSchema when the target keyspace is sharded. A missing entry means the move/redistribute stream would target a table the vschema does not know about.","triggerScenarios":"prepareMaterializerStreams building a Materializer (Reshard/MoveTables-style flows) where ms.TableSettings references a table absent from targetVSchema.Tables.","commonSituations":"MoveTables/Reshard invoked for a table not present in the target keyspace vschema; typo in table name; vschema on the target keyspace not yet updated after adding a table.","solutions":["Run vtctldclient GetVSchema <targetKeyspace> and confirm the table is listed under tables.","Add the table to the target keyspace vschema via ApplyVSchema, then retry the workflow.","Fix typos in the table name supplied to the workflow command."],"exampleFix":"// before: target vschema lacks the table\nvtctldclient MoveTables --source commerce --target customer --tables corder\n// after: add table to customer vschema first, then MoveTables","handlingStrategy":"validation","validationCode":"targetVS, _ := wr.ts.GetVSchema(ctx, targetKeyspace)\nif targetVS.Keyspace.Sharded {\n  for _, ts := range tableSettings {\n    if _, ok := targetVS.Tables[ts.TargetTable]; !ok {\n      return fmt.Errorf(\"table %s missing in %s vschema\", ts.TargetTable, targetKeyspace)\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure the target keyspace vschema lists every table before starting MoveTables/Reshard.","Validate table names against GetVSchema output before invoking the workflow.","Apply vschema changes to target keyspaces as part of table-adding runbooks."],"tags":["vschema","materializer","vreplication"],"backgroundTag":"table-not-found-in-vschema","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}