{"record":{"id":"39b35ca9849b9310","repo":"vitessio/vitess","slug":"table-v-not-found-in-vschema","errorCode":null,"errorMessage":"table %v not found in vschema","messagePattern":"table (.+?) not found in vschema","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/workflow/resharder.go","lineNumber":257,"sourceCode":"\t\tcase StreamTypeSharded:\n\t\t\tif streamType == StreamTypeReference {\n\t\t\t\treturn false, fmt.Errorf(\"cannot reshard streams with a mix of reference and sharded tables: %v\", bls)\n\t\t\t}\n\t\t\tstreamType = StreamTypeSharded\n\t\tcase StreamTypeReference:\n\t\t\tif streamType == StreamTypeSharded {\n\t\t\t\treturn false, fmt.Errorf(\"cannot reshard streams with a mix of reference and sharded tables: %v\", bls)\n\t\t\t}\n\t\t\tstreamType = StreamTypeReference\n\t\t}\n\t}\n\treturn streamType == StreamTypeReference, nil\n}\n\nfunc (rs *resharder) identifyRuleType(rule *binlogdatapb.Rule) (StreamType, error) {\n\tvtable, ok := rs.vschema.Tables[rule.Match]\n\tif !ok && !schema.IsInternalOperationTableName(rule.Match) {\n\t\treturn 0, fmt.Errorf(\"table %v not found in vschema\", rule.Match)\n\t}\n\tif vtable != nil && vtable.Type == vindexes.TypeReference {\n\t\treturn StreamTypeReference, nil\n\t}\n\t// In this case, 'sharded' means that it's not a reference\n\t// table. We don't care about any other subtleties.\n\treturn StreamTypeSharded, nil\n}\n\nfunc (rs *resharder) copySchema(ctx context.Context) error {\n\toneSource := rs.sourceShards[0].PrimaryAlias\n\terr := forAllShards(rs.targetShards, func(target *topo.ShardInfo) error {\n\t\treturn rs.s.CopySchemaShard(ctx, oneSource, []string{\"/.*\"}, nil, false, rs.keyspace, target.ShardName(), 1*time.Second, false)\n\t})\n\treturn err\n}\n\n// createStreams creates all of the VReplication streams that","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/workflow/resharder.go#L239-L275","documentation":"identifyRuleType classifies each filter rule by looking the matched table up in the loaded vschema. If the table is neither in the vschema nor a known internal operation table (like _vt schema-monitor tables), the rule cannot be classified and resharding fails. The vschema is the authoritative source for whether a table is reference or sharded.","triggerScenarios":"Running Reshard/MigrateStreams where a VReplication stream's filter references a table that is absent from the current vschema (table dropped, filter stale, keyspace not loaded, or typo in filter match).","commonSituations":"Tables removed from the vschema while old streams still filter on them; filters with wildcards or typos that match no real table; running the command against a keyspace whose vschema was never populated; internal tables mishandled in very old configs.","solutions":["Update the stream's filter to only reference tables present in the current vschema.","Add the missing table back to the vschema if it should exist.","Remove obsolete streams whose tables no longer exist before resharding."],"exampleFix":"// before: filter references dropped table\n{\"match\": \"old_table\"}\n// after: filter updated to existing tables\n{\"match\": \"customer\"}","handlingStrategy":"validation","validationCode":"// Pre-check that every rule match in stream filters exists in the vschema\nfor _, rule := range bls.Rules {\n    if _, ok := vschema.Tables[rule.Match]; !ok && !schema.IsInternalOperationTableName(rule.Match) {\n        return fmt.Errorf(\"rule match %q not in vschema\", rule.Match)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"not found in vschema\") {\n    // fix the stream filter or vschema, then retry\n}","preventionTips":["Update stream filters whenever tables are dropped from the vschema","Load the correct keyspace vschema before running migrations","Validate filter matches against the vschema as part of pre-migration checks"],"tags":["vreplication","vschema","validation","resharding"],"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"}