{"record":{"id":"0d7ea4b9a62a1a91","repo":"vitessio/vitess","slug":"streams-are-mismatched-across-source-shards-for-wo-0d7ea4","errorCode":null,"errorMessage":"streams are mismatched across source shards for workflow: %s","messagePattern":"streams are mismatched across source shards for workflow: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/wrangler/resharder.go","lineNumber":243,"sourceCode":"\t\t\t}\n\t\t\tisReference, err := rs.blsIsReference(&bls)\n\t\t\tif err != nil {\n\t\t\t\treturn vterrors.Wrap(err, \"blsIsReference\")\n\t\t\t}\n\t\t\tif !isReference {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tkey := fmt.Sprintf(\"%s:%s:%s\", workflow, bls.Keyspace, bls.Shard)\n\t\t\tif mustCreate {\n\t\t\t\trs.refStreams[key] = &refStream{\n\t\t\t\t\tworkflow:    workflow,\n\t\t\t\t\tbls:         &bls,\n\t\t\t\t\tcell:        row[2].ToString(),\n\t\t\t\t\ttabletTypes: row[3].ToString(),\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif !ref[key] {\n\t\t\t\t\treturn fmt.Errorf(\"streams are mismatched across source shards for workflow: %s\", workflow)\n\t\t\t\t}\n\t\t\t\tdelete(ref, key)\n\t\t\t}\n\t\t}\n\t\tif len(ref) != 0 {\n\t\t\treturn fmt.Errorf(\"streams are mismatched across source shards: %v\", ref)\n\t\t}\n\t\treturn nil\n\t})\n\treturn err\n}\n\n// blsIsReference is partially copied from streamMigrater.templatize.\n// It reuses the constants from that function also.\nfunc (rs *resharder) blsIsReference(bls *binlogdatapb.BinlogSource) (bool, error) {\n\tstreamType := workflow.StreamTypeUnknown\n\tfor _, rule := range bls.Filter.Rules {\n\t\ttyp, err := rs.identifyRuleType(rule)","sourceCodeStart":225,"sourceCodeEnd":261,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/wrangler/resharder.go#L225-L261","documentation":"Before migrating streams, the code builds a reference set of (BinlogSource, cell, tabletTypes) tuples from the first source shard and requires every other source shard to have exactly the same stream set. If a later shard contains a stream whose key is not in the reference set, the streams are inconsistent and migration is aborted with this error naming the workflow.","triggerScenarios":"Running Reshard when source shards' `_vt.vreplication` rows for a workflow do not match across shards — e.g. one shard has an extra filter rule or different keyspace/table settings than the others.","commonSituations":"A stream was created/edited on only one shard (manual VDP operations); a prior partial migration updated some shards but not others; filter rules were modified on one shard's streams during an emergency.","solutions":["Dump streams on all source shards: `SELECT workflow, binlog_source, cell, tablet_types FROM _vt.vreplication;` on each source primary.","Diff the binlog_source/cell/tablet_types tuples against the reference shard and correct the mismatched shard (delete and recreate its stream to match the others).","If the workflow is obsolete on the odd shard, delete that row rather than reconciling it.","Re-run the reshard; if you still see mismatches, repeat until every source shard's stream set is identical."],"exampleFix":"-- before: shard 0 filter = {table:'t1'}, shard 1 filter = {table:'t2'}\nUPDATE _vt.vreplication SET binlog_source = <same as shard 0> WHERE workflow='w' AND rid=<id>;\n-- after: both shards have identical binlog_source","handlingStrategy":"validation","validationCode":"var ref []string\nfor each source shard {\n    keys := streamKeys(shard) // binlog_source|cell|tablet_types tuples\n    if ref == nil { ref = keys; continue }\n    if !equalSets(ref, keys) { return fmt.Errorf(\"streams differ across shards\") }\n}","typeGuard":"func streamSetsEqual(a, b map[string]bool) bool { return maps.Equal(a, b) }","tryCatchPattern":"if err := wr.Reshard(...); err != nil {\n    if strings.Contains(err.Error(), \"streams are mismatched\") {\n        return reconcileStreamsAcrossShards(ctx, workflow)\n    }\n    return err\n}","preventionTips":["Create VReplication streams only via MoveTables/Reshard tooling so all shards get identical configs","Never edit filter rules on a single shard's streams","Audit stream configs across source shards before resharding"],"tags":["vreplication","reshard","consistency","workflow"],"backgroundTag":"vreplication-stream-mismatch","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}