vitessio/vitess · error

table %v not found in vschema

Error message

table %v not found in vschema

What it means

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.

Source

Thrown at go/vt/vtctl/workflow/resharder.go:257

		case StreamTypeSharded:
			if streamType == StreamTypeReference {
				return false, fmt.Errorf("cannot reshard streams with a mix of reference and sharded tables: %v", bls)
			}
			streamType = StreamTypeSharded
		case StreamTypeReference:
			if streamType == StreamTypeSharded {
				return false, fmt.Errorf("cannot reshard streams with a mix of reference and sharded tables: %v", bls)
			}
			streamType = StreamTypeReference
		}
	}
	return streamType == StreamTypeReference, nil
}

func (rs *resharder) identifyRuleType(rule *binlogdatapb.Rule) (StreamType, error) {
	vtable, ok := rs.vschema.Tables[rule.Match]
	if !ok && !schema.IsInternalOperationTableName(rule.Match) {
		return 0, fmt.Errorf("table %v not found in vschema", rule.Match)
	}
	if vtable != nil && vtable.Type == vindexes.TypeReference {
		return StreamTypeReference, nil
	}
	// In this case, 'sharded' means that it's not a reference
	// table. We don't care about any other subtleties.
	return StreamTypeSharded, nil
}

func (rs *resharder) copySchema(ctx context.Context) error {
	oneSource := rs.sourceShards[0].PrimaryAlias
	err := forAllShards(rs.targetShards, func(target *topo.ShardInfo) error {
		return rs.s.CopySchemaShard(ctx, oneSource, []string{"/.*"}, nil, false, rs.keyspace, target.ShardName(), 1*time.Second, false)
	})
	return err
}

// createStreams creates all of the VReplication streams that

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Update the stream's filter to only reference tables present in the current vschema.
  2. Add the missing table back to the vschema if it should exist.
  3. Remove obsolete streams whose tables no longer exist before resharding.

Example fix

// before: filter references dropped table
{"match": "old_table"}
// after: filter updated to existing tables
{"match": "customer"}
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check that every rule match in stream filters exists in the vschema
for _, rule := range bls.Rules {
    if _, ok := vschema.Tables[rule.Match]; !ok && !schema.IsInternalOperationTableName(rule.Match) {
        return fmt.Errorf("rule match %q not in vschema", rule.Match)
    }
}

Try / catch

if err != nil && strings.Contains(err.Error(), "not found in vschema") {
    // fix the stream filter or vschema, then retry
}

Prevention

When it happens

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

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

Related errors


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