vitessio/vitess · error

streams are mismatched across source shards: %v

Error message

streams are mismatched across source shards: %v

What it means

After processing all streams on a source shard, the resharder checks that the accumulated set of reference-stream keys (ref) has been fully matched. Leftover keys mean some reference streams exist on one shard but not on others, so the stream sets across source shards are inconsistent and resharding is aborted.

Source

Thrown at go/vt/vtctl/workflow/resharder.go:220

				refKey := fmt.Sprintf("%s:%s:%s", workflow.Workflow, bls.Keyspace, bls.Shard)
				if mustCreate {
					rs.refStreams[refKey] = &refStream{
						workflow:        workflow.Workflow,
						bls:             bls,
						cell:            workflow.Cells,
						tabletTypes:     discovery.BuildTabletTypesString(workflow.TabletTypes, workflow.TabletSelectionPreference),
						workflowType:    workflow.WorkflowType,
						workflowSubType: workflow.WorkflowSubType,
					}
				} else {
					if !ref[refKey] {
						return fmt.Errorf("streams are mismatched across source shards for workflow: %s", workflow)
					}
					delete(ref, refKey)
				}
			}
			if len(ref) != 0 {
				return fmt.Errorf("streams are mismatched across source shards: %v", ref)
			}
		}
		return nil
	})
	return err
}

// blsIsReference is partially copied from streamMigrater.templatize.
// It reuses the constants from that function also.
func (rs *resharder) blsIsReference(bls *binlogdatapb.BinlogSource) (bool, error) {
	streamType := StreamTypeUnknown
	for _, rule := range bls.Filter.Rules {
		typ, err := rs.identifyRuleType(rule)
		if err != nil {
			return false, err
		}

		switch typ {

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Ensure every source shard has identical reference streams: compare _vt.vreplication rows across shards.
  2. Recreate the missing reference streams on the shards that lack them.
  3. Cancel and re-run the stream migration once all shards are consistent.
Defensive patterns

Strategy: validation

Validate before calling

-- Ensure reference streams exist identically on all source shards
SELECT shard, workflow FROM _vt.vreplication WHERE workflow LIKE '%reference%' ORDER BY workflow, shard;

Try / catch

if err != nil && strings.Contains(err.Error(), "mismatched across source shards: ") {
    // parse the listed ref keys and create the missing streams
}

Prevention

When it happens

Trigger: Reshard/MigrateStreams where reference-table streams (streams filtering on reference tables) exist on some source shards but are missing (or have differing filter/settings) on others.

Common situations: Reference table streams were set up on a subset of shards; an interrupted migration left partial reference streams; manual per-shard stream creation for reference tables.

Related errors


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/5d656d4e42e5726d. Report an issue: GitHub.