{"record":{"id":"871e2517218c8157","repo":"vitessio/vitess","slug":"validatevschema-v-v-v-v-failed-v","errorCode":null,"errorMessage":"ValidateVSchema(%v, %v, %v, %v) failed: %v","messagePattern":"ValidateVSchema\\((.+?), (.+?), (.+?), (.+?)\\) failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/wrangler/schema.go","lineNumber":171,"sourceCode":"\t\t\t\t))\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfor _, tableDef := range primarySchema.TableDefinitions {\n\t\t\t\tif _, ok := vschm.Tables[tableDef.Name]; !ok {\n\t\t\t\t\tif !schema.IsInternalOperationTableName(tableDef.Name) {\n\t\t\t\t\t\tnotFoundTables = append(notFoundTables, tableDef.Name)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif len(notFoundTables) > 0 {\n\t\t\t\tshardFailure := fmt.Errorf(\"%v/%v has tables that are not in the vschema: %v\", keyspace, shard, notFoundTables)\n\t\t\t\tshardFailures.RecordError(shardFailure)\n\t\t\t}\n\t\t}(shard)\n\t}\n\twg.Wait()\n\tif shardFailures.HasErrors() {\n\t\treturn fmt.Errorf(\"ValidateVSchema(%v, %v, %v, %v) failed: %v\", keyspace, shards, excludeTables, includeViews, shardFailures.Error().Error())\n\t}\n\treturn nil\n}\n\n// PreflightSchema will try a schema change on the remote tablet.\nfunc (wr *Wrangler) PreflightSchema(ctx context.Context, tabletAlias *topodatapb.TabletAlias, changes []string) ([]*tabletmanagerdatapb.SchemaChangeResult, error) {\n\tti, err := wr.ts.GetTablet(ctx, tabletAlias)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"GetTablet(%v) failed: %v\", tabletAlias, err)\n\t}\n\treturn wr.tmc.PreflightSchema(ctx, ti.Tablet, changes)\n}\n\n// CopySchemaShardFromShard copies the schema from a source shard to the specified destination shard.\n// For both source and destination it picks the primary tablet. See also CopySchemaShard.\nfunc (wr *Wrangler) CopySchemaShardFromShard(ctx context.Context, tables, excludeTables []string, includeViews bool, sourceKeyspace, sourceShard, destKeyspace, destShard string, waitReplicasTimeout time.Duration, skipVerify bool) error {\n\tsourceShardInfo, err := wr.ts.GetShard(ctx, sourceKeyspace, sourceShard)\n\tif err != nil {","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/wrangler/schema.go#L153-L189","documentation":"ValidateVSchema aggregates all per-shard failures (topo GetShard errors, GetSchema RPC errors, tables missing from vschema) into a ConcurrencyErrorList. If any failures were recorded, this top-level error is returned wrapping the full aggregated message, attributing the failure to the ValidateVSchema call with its keyspace, shards, excludeTables, includeViews arguments.","triggerScenarios":"Any invocation of ValidateVSchema (directly or via ValidateSchemaShard / vtctl ValidateVSchema command) where at least one shard goroutine recorded a failure — shard lookup failed, schema fetch failed, or tables were missing from the vschema.","commonSituations":"Composite failure during a validation audit: mixed causes such as one shard down plus another shard with drifted vschema; users see this wrapper and must read the inner aggregated message for per-shard detail.","solutions":["Read the aggregated inner message (after 'failed: ') to identify the per-shard root causes.","Fix each per-shard issue (shard existence, tablet health, vschema entries) per the inner errors.","Re-run ValidateVSchema after remediation to get a clean pass.","Ensure the correct shard list was passed (no stale shard names)."],"exampleFix":"// before: wrapper hides detail\nValidateVSchema(commerce, [\"0\",\"-\"]) failed: \"/0 has tables that are not in the vschema: [orders]\"\n// after: fix vschema then re-run\nvtctldclient ApplyVSchema --vschema=$(cat vschema.json) commerce\nwr.ValidateVSchema(ctx, \"commerce\", []string{\"0\"}, nil, nil, true)","handlingStrategy":"try-catch","validationCode":"// pre-validate each shard and vschema before the aggregate call\nfor _, shard := range shards {\n\tif _, err := ts.GetShard(ctx, ks, shard); err != nil { return err }\n}\nif _, err := ts.GetVSchema(ctx, ks); err != nil { return err }","typeGuard":null,"tryCatchPattern":"err := wr.ValidateVSchema(ctx, ks, shards, excludeTables, includeViews, includeViews)\nif err != nil {\n\tvar wErr *vterrors.VtError\n\tif errors.As(err, &wErr) { /* inspect aggregated per-shard causes */ }\n\treturn err\n}","preventionTips":["Read the aggregated message after 'failed: ' for per-shard root causes","Fix and re-run iteratively; each pass reveals remaining shard issues","Automate validation runs and alert on the wrapper error"],"tags":["validation","vschema","aggregated-error","wrangler"],"backgroundTag":"schema-validation-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}