vitessio/vitess · error

table %s not found in schema

Error message

table %s not found in schema

What it means

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.

Source

Thrown at go/vt/vttablet/tabletmanager/vreplication/table_plan_builder.go:164

		collationEnv:   collationEnv,
		workflowConfig: vr.workflowConfig,
	}
	for tableName := range colInfoMap {
		lastpk, ok := copyState[tableName]
		if ok && lastpk == nil {
			// Don't replicate uncopied tables.
			continue
		}
		rule, err := MatchTable(tableName, filter)
		if err != nil {
			return nil, err
		}
		if rule == nil {
			continue
		}
		colInfos, ok := colInfoMap[tableName]
		if !ok {
			return nil, fmt.Errorf("table %s not found in schema", tableName)
		}
		tablePlan, err := buildTablePlan(tableName, rule, colInfos, lastpk, stats, source, collationEnv, parser, vr.workflowConfig)
		if err != nil {
			return nil, vterrors.Wrapf(err, "failed to build table replication plan for %s table", tableName)
		}
		if tablePlan == nil {
			// Table was excluded.
			continue
		}
		if dup, ok := plan.TablePlans[tablePlan.SendRule.Match]; ok {
			return nil, fmt.Errorf("more than one target for source table %s: %s and %s", tablePlan.SendRule.Match, dup.TargetName, tableName)
		}
		plan.VStreamFilter.Rules = append(plan.VStreamFilter.Rules, tablePlan.SendRule)
		plan.TargetTables[tableName] = tablePlan
		plan.TablePlans[tablePlan.SendRule.Match] = tablePlan
	}
	return plan, nil
}

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Verify the table exists on the source: run `SHOW TABLES` against the source keyspace/tablet
  2. Correct the table name in the Filter's rules (check spelling and case)
  3. If the table was intentionally dropped, remove or narrow the rule so it no longer matches
  4. Refresh the source tablet schema (`RestartReplication` / schema reload) if the cache is stale

Example fix

// before
"rules": [{"match": "custmers", "targetTable": "customers"}]
// after
"rules": [{"match": "customers", "targetTable": "customers"}]
Defensive patterns

Strategy: validation

Validate before calling

tables, err := getSchemaTables(sourceTablet)
if err != nil { return err }
for _, r := range filter.Rules {
    for _, t := range matchTables(r.Match, tables) {
        if !slices.Contains(tables, t) {
            return fmt.Errorf("rule %q references missing table %q", r.Match, t)
        }
    }
}

Type guard

func tableInSchema(name string, colInfoMap map[string]TableColInfo) bool {
    _, ok := colInfoMap[name]
    return ok
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/bfc333b21733444a. Report an issue: GitHub.