vitessio/vitess · error
source table %v does not exist
Error message
source table %v does not exist
What it means
With CreateDdl set to a 'copy' mode, the materializer looks up the source table's CREATE DDL fetched from the source primary (sourceDDLs map keyed by table name). If the TargetTable has no matching table on the source keyspace, it fails because there is no schema to copy.
Source
Thrown at go/vt/wrangler/materializer.go:1218
return err
}
createDDL := ts.CreateDdl
if createDDL == createDDLAsCopy || createDDL == createDDLAsCopyDropConstraint || createDDL == createDDLAsCopyDropForeignKeys {
if ts.SourceExpression != "" {
// Check for table if non-empty SourceExpression.
sourceTableName, err := mz.wr.env.Parser().TableFromStatement(ts.SourceExpression)
if err != nil {
return err
}
if sourceTableName.Name.String() != ts.TargetTable {
return fmt.Errorf("source and target table names must match for copying schema: %v vs %v", sqlparser.String(sourceTableName), ts.TargetTable)
}
}
ddl, ok := sourceDDLs[ts.TargetTable]
if !ok {
return fmt.Errorf("source table %v does not exist", ts.TargetTable)
}
if createDDL == createDDLAsCopyDropConstraint {
strippedDDL, err := stripTableConstraints(ddl, mz.wr.env.Parser())
if err != nil {
return err
}
ddl = strippedDDL
}
if createDDL == createDDLAsCopyDropForeignKeys {
strippedDDL, err := stripTableForeignKeys(ddl, mz.wr.env.Parser())
if err != nil {
return err
}
ddl = strippedDDLView on GitHub (pinned to 01a25a7d17)
Solutions
- Verify the table exists on the source: `vtctldclient GetSchema --table-names=<table> <source-keyspace>`
- Fix the table name typo in the workflow configuration
- Create the table on the source before re-running, or supply an explicit CreateDdl instead of 'copy'
Example fix
// before vtctldclient MoveTables --target-keyspace=commerce create --source-keyspace=inventory --tables='custmer' --create-ddl='copy' // after (correct name or explicit DDL) vtctldclient MoveTables --target-keyspace=commerce create --source-keyspace=inventory --tables='customer' --create-ddl='copy'
Defensive patterns
Strategy: validation
Validate before calling
present, err := sourceTableExists(ctx, sourceKeyspace, targetTable)
if err != nil { return err }
if !present {
return fmt.Errorf("table %s does not exist on source keyspace %s", targetTable, sourceKeyspace)
} Prevention
- Run `vtctldclient GetSchema --table-names=<t> <keyspace>` to confirm source tables before workflows
- Keep workflow configs in sync with source schema changes
- Prefer explicit CreateDdl for tables prone to renaming
When it happens
Trigger: MoveTables/Materialize with --create-ddl=copy for a table that does not exist on the source keyspace; typo in table name; table exists on target but was dropped on source; source schema fetched via regex /.*/ didn't include the table (e.g. it's a view excluded from GetSchema).
Common situations: Copying schema for a table renamed on the source; running workflow against a source keyspace that never had the table; stale workflow config after source schema changes.
Related errors
- source table %v does not exist
- source shard must have a primary for copying schema: %v
- target table %v does not exist and there is no create ddl de
- source and target table names must match for copying schema:
- table %s not found in vschema for keyspace %s
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/16c78e64d39e9f03.
Report an issue: GitHub.