{"record":{"id":"75b9085a7bae0dd3","repo":"vitessio/vitess","slug":"a-conflicting-table-named-v-already-exists-in-the","errorCode":null,"errorMessage":"a conflicting table named %v already exists in the target vschema","messagePattern":"a conflicting table named (.+?) already exists in the target vschema","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/wrangler/materializer.go","lineNumber":773,"sourceCode":"\t\t\tif !proto.Equal(existing, targetVindex) {\n\t\t\t\treturn nil, nil, nil, fmt.Errorf(\"a conflicting vindex named %v already exists in the target vschema\", targetVindexType)\n\t\t\t}\n\t\t} else {\n\t\t\ttargetVSchema.Vindexes[targetVindexType] = targetVindex\n\t\t}\n\n\t\ttargetTable = &vschemapb.Table{\n\t\t\tColumnVindexes: []*vschemapb.ColumnVindex{{\n\t\t\t\tColumn: vindexFromCols[0],\n\t\t\t\tName:   targetVindexType,\n\t\t\t}},\n\t\t}\n\t} else {\n\t\ttargetTable = &vschemapb.Table{}\n\t}\n\tif existing, ok := targetVSchema.Tables[targetTableName]; ok {\n\t\tif !proto.Equal(existing, targetTable) {\n\t\t\treturn nil, nil, nil, fmt.Errorf(\"a conflicting table named %v already exists in the target vschema\", targetTableName)\n\t\t}\n\t} else {\n\t\ttargetVSchema.Tables[targetTableName] = targetTable\n\t}\n\n\tms = &vtctldatapb.MaterializeSettings{\n\t\tWorkflow:              targetTableName + \"_vdx\",\n\t\tMaterializationIntent: vtctldatapb.MaterializationIntent_CREATELOOKUPINDEX,\n\t\tSourceKeyspace:        keyspace,\n\t\tTargetKeyspace:        targetKeyspace,\n\t\tStopAfterCopy:         vindex.Owner != \"\" && !continueAfterCopyWithOwner,\n\t\tTableSettings: []*vtctldatapb.TableMaterializeSettings{{\n\t\t\tTargetTable:      targetTableName,\n\t\t\tSourceExpression: materializeQuery,\n\t\t\tCreateDdl:        createDDL,\n\t\t}},\n\t}\n","sourceCodeStart":755,"sourceCodeEnd":791,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/wrangler/materializer.go#L755-L791","documentation":"CreateLookupVindex builds a target-vschemapb.Table describing the new lookup table's ColumnVindexes and checks the target vschema's Tables map. If the target table name already exists there with a different configuration (proto.Equal fails), creation is refused to avoid silently overwriting the existing table's vindex setup.","triggerScenarios":"The chosen target (lookup) table name already exists in the target keyspace vschema with different ColumnVindexes than the ones Vitess would generate — e.g. a previous CreateLookupVindex or a manually configured table entry.","commonSituations":"Re-running CreateLookupVindex after changing the target table's config; reusing an existing lookup table name from another vindex; stale vschema from an aborted earlier attempt.","solutions":["Pick a different target lookup table name, or remove/reconcile the existing entry in the target vschema and retry","Compare the existing vschema table config (`vtctldclient GetVSchema <target-keyspace>`) with what CreateLookupVindex would create and align them","If a previous attempt left the entry, clean up the leftover lookup table and vschema entry before re-running"],"exampleFix":"// before: stale target table entry differs\n\"customer_lookup\": {\"column_vindexes\": [{\"name\":\"hash\",\"column\":\"cust_id\"}]}\n// after: remove it or choose a new lookup table name\n\"customer_lookup_v2\": {}","handlingStrategy":"validation","validationCode":"tvs, _ := ts.GetVSchema(ctx, targetKeyspace)\nif tvs.Tables[targetTableName] != nil {\n    return fmt.Errorf(\"target table %s already configured in vschema; reconcile first\", targetTableName)\n}","typeGuard":"func targetTableConfigured(tvs *vschemapb.Keyspace, table string) bool {\n    return tvs.Tables != nil && tvs.Tables[table] != nil\n}","tryCatchPattern":"if err := createLookupVindex(...); err != nil {\n    if strings.Contains(err.Error(), \"conflicting table named\") {\n        return reconcileTargetTable(targetKS, targetTable) // align or remove entry, retry\n    }\n    return err\n}","preventionTips":["Choose unique lookup table names per vindex (e.g. <source>_<vindex>_lookup)","Clean up leftover vschema entries from aborted CreateLookupVindex runs","Diff the target vschema before/after materialization workflows"],"tags":["vitess","vschema","vindex","conflict"],"backgroundTag":"vschema-name-conflict","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}