{"record":{"id":"16c78e64d39e9f03","repo":"vitessio/vitess","slug":"source-table-v-does-not-exist-16c78e","errorCode":null,"errorMessage":"source table %v does not exist","messagePattern":"source table (.+?) does not exist","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/wrangler/materializer.go","lineNumber":1218,"sourceCode":"\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tcreateDDL := ts.CreateDdl\n\t\t\tif createDDL == createDDLAsCopy || createDDL == createDDLAsCopyDropConstraint || createDDL == createDDLAsCopyDropForeignKeys {\n\t\t\t\tif ts.SourceExpression != \"\" {\n\t\t\t\t\t// Check for table if non-empty SourceExpression.\n\t\t\t\t\tsourceTableName, err := mz.wr.env.Parser().TableFromStatement(ts.SourceExpression)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tif sourceTableName.Name.String() != ts.TargetTable {\n\t\t\t\t\t\treturn fmt.Errorf(\"source and target table names must match for copying schema: %v vs %v\", sqlparser.String(sourceTableName), ts.TargetTable)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tddl, ok := sourceDDLs[ts.TargetTable]\n\t\t\t\tif !ok {\n\t\t\t\t\treturn fmt.Errorf(\"source table %v does not exist\", ts.TargetTable)\n\t\t\t\t}\n\n\t\t\t\tif createDDL == createDDLAsCopyDropConstraint {\n\t\t\t\t\tstrippedDDL, err := stripTableConstraints(ddl, mz.wr.env.Parser())\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\n\t\t\t\t\tddl = strippedDDL\n\t\t\t\t}\n\n\t\t\t\tif createDDL == createDDLAsCopyDropForeignKeys {\n\t\t\t\t\tstrippedDDL, err := stripTableForeignKeys(ddl, mz.wr.env.Parser())\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\n\t\t\t\t\tddl = strippedDDL","sourceCodeStart":1200,"sourceCodeEnd":1236,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/wrangler/materializer.go#L1200-L1236","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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'"],"exampleFix":"// before\nvtctldclient MoveTables --target-keyspace=commerce create --source-keyspace=inventory --tables='custmer' --create-ddl='copy'\n// after (correct name or explicit DDL)\nvtctldclient MoveTables --target-keyspace=commerce create --source-keyspace=inventory --tables='customer' --create-ddl='copy'","handlingStrategy":"validation","validationCode":"present, err := sourceTableExists(ctx, sourceKeyspace, targetTable)\nif err != nil { return err }\nif !present {\n    return fmt.Errorf(\"table %s does not exist on source keyspace %s\", targetTable, sourceKeyspace)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["vitess","wrangler","schema-copy","missing-table"],"backgroundTag":"source-table-not-found","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}