{"record":{"id":"956f1feaf040cb7c","repo":"vitessio/vitess","slug":"source-table-v-does-not-exist","errorCode":null,"errorMessage":"source table %v does not exist","messagePattern":"source table (.+?) does not exist","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/workflow/materializer.go","lineNumber":369,"sourceCode":"\t\t\t}\n\n\t\t\tcreateDDL := ts.CreateDdl\n\t\t\t// Make any necessary adjustments to the create DDL.\n\t\t\tif removeAutoInc || 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.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.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.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":351,"sourceCodeEnd":387,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/workflow/materializer.go#L351-L387","documentation":"During schema copying for a materialize workflow, the materializer looks up the CREATE TABLE DDL for each target table in the source keyspace. This error is thrown when the target table (which must match a source table name) has no corresponding DDL entry fetched from the source database, meaning the table does not exist on the source. It guards against building a copy-schema workflow for a table that cannot be copied.","triggerScenarios":"Running CreateWorkflow/MoveTables or Reshard with CopySchema (default) enabled while one of the requested tables (ts.TargetTable) is missing from the source keyspace's tables, so sourceDDLs lookup fails.","commonSituations":"Typo in table name in the --tables flag; table exists in target vschema but was dropped on the source; case-sensitivity mismatch between requested name and actual source table; copying schema after source table was renamed during a migration.","solutions":["Verify the table exists on the source: run SHOW TABLES on the source keyspace and correct the table name in the workflow request","Re-create or restore the missing table on the source before creating the workflow","Use --no-copy-schema (or createDDL mode without copy) if you manage the target schema yourself"],"exampleFix":"// before\nCreateWorkflow --workflow=sales --target-keyspace=copy --tables=customerss\n// after\nCreateWorkflow --workflow=sales --target-keyspace=copy --tables=customers","handlingStrategy":"validation","validationCode":"tables := []string{\"customer\", \"orders\"}\nsrcTables, _ := vtctlClient.ExecuteCommand(ctx, \"SHOW\", \"TABLES\", \"FROM\", \"commerce\")\nfor _, t := range tables {\n    if !contains(srcTables, t) {\n        return fmt.Errorf(\"table %s missing on source; fix --tables before CreateWorkflow\", t)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := createWorkflow(ctx, req); err != nil {\n    if strings.Contains(err.Error(), \"does not exist\") {\n        // correct table names against SHOW TABLES on source and retry\n    }\n    return err\n}","preventionTips":["Run SHOW TABLES on the source keyspace before listing tables in the workflow request","Copy table names programmatically rather than typing them","Decide explicitly whether you want schema copy; use --no-copy-schema if you manage target schema"],"tags":["vitess","workflow","materialize","schema-copy","missing-table"],"backgroundTag":"source-table-missing","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}