{"record":{"id":"53970ccc4b8ee463","repo":"vitessio/vitess","slug":"table-v-not-found-in-vschema-53970c","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/stream_migrator.go","lineNumber":1115,"sourceCode":"\t\t\t\t}\n\t\t\t\tstreamType = StreamTypeReference\n\t\t\t}\n\t\t}\n\n\t\tif streamType == StreamTypeSharded {\n\t\t\tshardedStreams = append(shardedStreams, vrs)\n\t\t}\n\t}\n\n\treturn shardedStreams, nil\n}\n\n// templatizeRule replaces keyrange values with {{.}}.\n// This can then be used by go's template package to substitute other keyrange values.\nfunc (sm *StreamMigrator) templatizeRule(ctx context.Context, rule *binlogdatapb.Rule) (StreamType, error) {\n\tvtable, ok := sm.ts.SourceKeyspaceSchema().Tables[rule.Match]\n\tif !ok && !schema.IsInternalOperationTableName(rule.Match) {\n\t\treturn StreamTypeUnknown, fmt.Errorf(\"table %v not found in vschema\", rule.Match)\n\t}\n\n\tif vtable != nil && vtable.Type == vindexes.TypeReference {\n\t\treturn StreamTypeReference, nil\n\t}\n\n\tswitch {\n\tcase rule.Filter == \"\":\n\t\treturn StreamTypeUnknown, fmt.Errorf(\"rule %v does not have a select expression in vreplication\", rule)\n\tcase key.IsValidKeyRange(rule.Filter):\n\t\trule.Filter = \"{{.}}\"\n\t\treturn StreamTypeSharded, nil\n\tcase rule.Filter == vreplication.ExcludeStr:\n\t\treturn StreamTypeUnknown, fmt.Errorf(\"unexpected rule in vreplication: %v\", rule)\n\tdefault:\n\t\tif err := sm.templatizeKeyRange(ctx, rule); err != nil {\n\t\t\treturn StreamTypeUnknown, err\n\t\t}","sourceCodeStart":1097,"sourceCodeEnd":1133,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/workflow/stream_migrator.go#L1097-L1133","documentation":"templatizeRule looks up each filter rule's Match table in the source keyspace's vschema (SourceKeyspaceSchema). If the table is absent from the vschema and is not a Vitess internal operation table (_vt_HEX..., etc.), the rule cannot be classified as sharded or reference, so this error is thrown. It means the vreplication filter references a table Vitess does not know about.","triggerScenarios":"templatize -> templatizeRule during BuildStreamMigrator/StopStreams where rule.Match names a table missing from sm.ts.SourceKeyspaceSchema().Tables — e.g. the table was dropped, the vschema doesn't declare it, or the keyspace's schema view is stale.","commonSituations":"Table dropped after the workflow was created; table exists only in MySQL but has no vindex/vschema definition; keyspace was resharded/renamed and the source schema cache is stale; typo in the rule Match used when the workflow was built; internal tables that the running Vitess version doesn't recognize.","solutions":["Compare the rule's Match against the keyspace vschema (`show vschema tables` / check the vschema json) and fix or remove the stale rule.","Cancel and recreate the vreplication workflow with a filter covering only tables that exist in the source vschema.","If the table should exist, re-run ReloadSchema on the source tablets and ensure the vschema defines the table with vindexes.","Check whether the table is a newer internal operation table and upgrade Vitess if the version predates its recognition (schema.IsInternalOperationTableName)."],"exampleFix":"// before: rule.Match='staging.orders' but orders not in vschema\n// after: add to vschema or drop the rule\n// vschema: \"orders\": {\"type\": \"scalar\"}  (or recreate workflow without that rule)","handlingStrategy":"validation","validationCode":"-- Every rule.Match must exist in the source keyspace vschema\n-- SHOW VSCHEMA TABLES; compare against:\nSELECT id, workflow, source FROM _vt.vreplication;  -- parse rules and check Match names","typeGuard":"func tableInVschema(table string, vs *vschema.VSchema) bool { _, ok := vs.Tables[table]; return ok }","tryCatchPattern":null,"preventionTips":["Reload schema on source tablets after DDL (ReloadSchema) so the vschema view is current.","Cancel workflows before dropping their target tables.","Keep vschema definitions in version control and review DDL against them."],"tags":["vitess","vschema","vreplication","schema-drift","config-error"],"backgroundTag":"table-not-in-vschema","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}