{"record":{"id":"bfc333b21733444a","repo":"vitessio/vitess","slug":"table-s-not-found-in-schema","errorCode":null,"errorMessage":"table %s not found in schema","messagePattern":"table (.+?) not found in schema","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vttablet/tabletmanager/vreplication/table_plan_builder.go","lineNumber":164,"sourceCode":"\t\tcollationEnv:   collationEnv,\n\t\tworkflowConfig: vr.workflowConfig,\n\t}\n\tfor tableName := range colInfoMap {\n\t\tlastpk, ok := copyState[tableName]\n\t\tif ok && lastpk == nil {\n\t\t\t// Don't replicate uncopied tables.\n\t\t\tcontinue\n\t\t}\n\t\trule, err := MatchTable(tableName, filter)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif rule == nil {\n\t\t\tcontinue\n\t\t}\n\t\tcolInfos, ok := colInfoMap[tableName]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"table %s not found in schema\", tableName)\n\t\t}\n\t\ttablePlan, err := buildTablePlan(tableName, rule, colInfos, lastpk, stats, source, collationEnv, parser, vr.workflowConfig)\n\t\tif err != nil {\n\t\t\treturn nil, vterrors.Wrapf(err, \"failed to build table replication plan for %s table\", tableName)\n\t\t}\n\t\tif tablePlan == nil {\n\t\t\t// Table was excluded.\n\t\t\tcontinue\n\t\t}\n\t\tif dup, ok := plan.TablePlans[tablePlan.SendRule.Match]; ok {\n\t\t\treturn nil, fmt.Errorf(\"more than one target for source table %s: %s and %s\", tablePlan.SendRule.Match, dup.TargetName, tableName)\n\t\t}\n\t\tplan.VStreamFilter.Rules = append(plan.VStreamFilter.Rules, tablePlan.SendRule)\n\t\tplan.TargetTables[tableName] = tablePlan\n\t\tplan.TablePlans[tablePlan.SendRule.Match] = tablePlan\n\t}\n\treturn plan, nil\n}","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vttablet/tabletmanager/vreplication/table_plan_builder.go#L146-L182","documentation":"During vreplication plan construction, buildReplicatorPlan iterates over filter rules and looks up each matched table's column info (colInfoMap), which was populated from the source tablet's schema. If a send rule names a table that is absent from the schema snapshot, planning aborts with this error. It protects the replicator from generating plans against non-existent tables.","triggerScenarios":"A MoveTables/Reshard Filter contains a table name (literal or regex match) that does not exist in the source keyspace's schema when initTablesForCopy/copyTable builds the plan.","commonSituations":"Typo in the filter rules JSON; table dropped on the source after the workflow was configured; rule regex matching a table that was since renamed; stale schema cache on the source tablet.","solutions":["Verify the table exists on the source: run `SHOW TABLES` against the source keyspace/tablet","Correct the table name in the Filter's rules (check spelling and case)","If the table was intentionally dropped, remove or narrow the rule so it no longer matches","Refresh the source tablet schema (`RestartReplication` / schema reload) if the cache is stale"],"exampleFix":"// before\n\"rules\": [{\"match\": \"custmers\", \"targetTable\": \"customers\"}]\n// after\n\"rules\": [{\"match\": \"customers\", \"targetTable\": \"customers\"}]","handlingStrategy":"validation","validationCode":"tables, err := getSchemaTables(sourceTablet)\nif err != nil { return err }\nfor _, r := range filter.Rules {\n    for _, t := range matchTables(r.Match, tables) {\n        if !slices.Contains(tables, t) {\n            return fmt.Errorf(\"rule %q references missing table %q\", r.Match, t)\n        }\n    }\n}","typeGuard":"func tableInSchema(name string, colInfoMap map[string]TableColInfo) bool {\n    _, ok := colInfoMap[name]\n    return ok\n}","tryCatchPattern":null,"preventionTips":["Validate filter rule table names against SHOW TABLES before starting the workflow","Avoid rules matching dropped/renamed tables; update filters on schema changes","Reload tablet schema after DDL so colInfoMap is fresh"],"tags":["vreplication","schema","filter-rules","plan-builder"],"backgroundTag":"table-not-in-schema","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}