{"record":{"id":"e719a1b297b316b2","repo":"vitessio/vitess","slug":"vindex-s-not-found-in-vschema","errorCode":null,"errorMessage":"vindex %s not found in vschema","messagePattern":"vindex (.+?) not found in vschema","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/wrangler/materializer.go","lineNumber":827,"sourceCode":"\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"column %s not found in schema %v\", sourceVindexCol, lines)\n}\n\n// ExternalizeVindex externalizes a lookup vindex that's finished backfilling or has caught up.\nfunc (wr *Wrangler) ExternalizeVindex(ctx context.Context, qualifiedVindexName string) error {\n\tsplits := strings.Split(qualifiedVindexName, \".\")\n\tif len(splits) != 2 {\n\t\treturn fmt.Errorf(\"vindex name should be of the form keyspace.vindex: %s\", qualifiedVindexName)\n\t}\n\tsourceKeyspace, vindexName := splits[0], splits[1]\n\tsourceVSchema, err := wr.ts.GetVSchema(ctx, sourceKeyspace)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsourceVindex := sourceVSchema.Vindexes[vindexName]\n\tif sourceVindex == nil {\n\t\treturn fmt.Errorf(\"vindex %s not found in vschema\", qualifiedVindexName)\n\t}\n\n\ttargetKeyspace, targetTableName, err := wr.env.Parser().ParseTable(sourceVindex.Params[\"table\"])\n\tif err != nil || targetKeyspace == \"\" {\n\t\treturn fmt.Errorf(\"vindex table name must be in the form <keyspace>.<table>. Got: %v\", sourceVindex.Params[\"table\"])\n\t}\n\tworkflow := targetTableName + \"_vdx\"\n\ttargetShards, err := wr.ts.GetServingShards(ctx, targetKeyspace)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Create a parallelizer function.\n\tforAllTargets := func(f func(*topo.ShardInfo) error) error {\n\t\tvar wg sync.WaitGroup\n\t\tallErrors := &concurrency.AllErrorRecorder{}\n\t\tfor _, targetShard := range targetShards {\n\t\t\twg.Add(1)","sourceCodeStart":809,"sourceCodeEnd":845,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/wrangler/materializer.go#L809-L845","documentation":"After loading the source keyspace's VSchema, Wrangler looks up the named vindex in sourceVSchema.Vindexes. If the map entry is nil, the vindex does not exist (or is not yet defined) in that keyspace, so externalization cannot proceed.","triggerScenarios":"ExternalizeVindex called with keyspace.vindex where vindex is misspelled, was never added to the keyspace vschema, or was already removed/externalized.","commonSituations":"Backfill workflow was run against a different keyspace than the one named in the ExternalizeVindex call; vindex was deleted from the vschema after backfill; typo in vindex name; pointing at the target keyspace instead of the source keyspace.","solutions":["Run vtctldclient GetVSchema <keyspace> and confirm the vindex appears under vindexes.","Correct the keyspace or vindex name to match the vschema definition.","If the vindex is missing, add it back to the vschema (ApplyVSchema) before externalizing."],"exampleFix":"// before\nwr.ExternalizeVindex(ctx, \"customer.corder_vdx\") // vindex lives in commerce\n// after\nwr.ExternalizeVindex(ctx, \"commerce.corder_vdx\")","handlingStrategy":"validation","validationCode":"vschema := mustGetVSchema(t, ctx, \"commerce\")\nif _, ok := vschema.Vindexes[\"corder_vdx\"]; !ok {\n  return fmt.Errorf(\"vindex corder_vdx not present in commerce vschema\")\n}","typeGuard":null,"tryCatchPattern":"if err := wr.ExternalizeVindex(ctx, \"commerce.corder_vdx\"); err != nil {\n  if strings.Contains(err.Error(), \"not found in vschema\") {\n    // fetch GetVSchema and log available vindexes before retrying\n  }\n}","preventionTips":["Run GetVSchema and confirm the vindex exists before externalizing.","Keep the vschema under version control to track vindex additions/removals.","Double-check which keyspace hosts the vindex vs. the workflow."],"tags":["vindex","vschema","vreplication"],"backgroundTag":"vindex-not-found-in-vschema","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}