vitessio/vitess · error

table %s is not present in the database

Error message

table %s is not present in the database

What it means

For non-regex filter rules, buildTablePlan verifies the rule's matched table exists in the tablet's live schema. If a rule names a table that GetSchema() doesn't return, planning fails with this error rather than silently streaming nothing.

Source

Thrown at go/vt/vttablet/tabletserver/vstreamer/uvstreamer.go:164

//
//	the first time, with just the filter and an empty pos
//	during a restart, with both the filter and list of TableLastPK from the vgtid
func (uvs *uvstreamer) buildTablePlan() error {
	uvs.plans = make(map[string]*tablePlan)
	tableLastPKs := make(map[string]*binlogdatapb.TableLastPK)
	for _, tablePK := range uvs.inTablePKs {
		if tablePK != nil && tablePK.Lastpk != nil && len(tablePK.Lastpk.Fields) == 0 {
			return fmt.Errorf("lastpk for table %s has no fields defined", tablePK.TableName)
		}
		tableLastPKs[tablePK.TableName] = tablePK
	}
	tables := uvs.se.GetSchema()
	for range tables {
		for _, rule := range uvs.filter.Rules {
			if !strings.HasPrefix(rule.Match, "/") {
				_, ok := tables[rule.Match]
				if !ok {
					return fmt.Errorf("table %s is not present in the database", rule.Match)
				}
			}
		}
	}

	// Set of tables to copy during the copy phase. Only if we need to copy
	// specific tables, else keep it nil if we need to copy every table.
	var tablesToCopySet sets.Set[string]
	if len(uvs.options.GetTablesToCopy()) > 0 {
		tablesToCopySet = sets.New(uvs.options.GetTablesToCopy()...)
	}

	for tableName := range tables {
		rule, err := matchTable(tableName, uvs.filter, tables)
		if err != nil {
			return err
		}
		if rule == nil {

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Compare the filter rule's Match value against SHOW TABLES on the source tablet; fix the rule spelling/case.
  2. Create the missing table in the source database, or remove it from the filter rules and update the workflow.
  3. If the table was intentionally dropped, update the VReplication workflow's filter (e.g. via MoveTables/Reshard tooling) and restart the stream.
Defensive patterns

Strategy: validation

Validate before calling

tables, _ := getSchemaTableNames(ctx, tablet) // SHOW TABLES
for _, rule := range filter.Rules {
    if !strings.HasPrefix(rule.Match, "/") && !slices.Contains(tables, rule.Match) {
        return fmt.Errorf("filter rule references missing table %s", rule.Match)
    }
}

Try / catch

err := uvstream(ctx, filter, nil)
if err != nil && strings.Contains(err.Error(), "is not present in the database") {
    // fix filter rules or create the table, then retry
}

Prevention

When it happens

Trigger: VStream filter rule with a literal table name (no '/' prefix) that is not present in the source keyspace/tablet schema at plan time.

Common situations: Typo in filter rule table name; table dropped after workflow was created; filter copied from another keyspace; case-sensitivity mismatch;MoveTables started before the table was created.

Related errors


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