{"record":{"id":"4dc315b454349e31","repo":"vitessio/vitess","slug":"cannot-reshard-streams-with-a-mix-of-reference-and","errorCode":null,"errorMessage":"cannot reshard streams with a mix of reference and sharded tables: %v","messagePattern":"cannot reshard streams with a mix of reference and sharded tables: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/workflow/resharder.go","lineNumber":241,"sourceCode":"\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 := StreamTypeUnknown\n\tfor _, rule := range bls.Filter.Rules {\n\t\ttyp, err := rs.identifyRuleType(rule)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\n\t\tswitch typ {\n\t\tcase StreamTypeSharded:\n\t\t\tif streamType == StreamTypeReference {\n\t\t\t\treturn false, fmt.Errorf(\"cannot reshard streams with a mix of reference and sharded tables: %v\", bls)\n\t\t\t}\n\t\t\tstreamType = StreamTypeSharded\n\t\tcase StreamTypeReference:\n\t\t\tif streamType == StreamTypeSharded {\n\t\t\t\treturn false, fmt.Errorf(\"cannot reshard streams with a mix of reference and sharded tables: %v\", bls)\n\t\t\t}\n\t\t\tstreamType = StreamTypeReference\n\t\t}\n\t}\n\treturn streamType == StreamTypeReference, nil\n}\n\nfunc (rs *resharder) identifyRuleType(rule *binlogdatapb.Rule) (StreamType, error) {\n\tvtable, ok := rs.vschema.Tables[rule.Match]\n\tif !ok && !schema.IsInternalOperationTableName(rule.Match) {\n\t\treturn 0, fmt.Errorf(\"table %v not found in vschema\", rule.Match)\n\t}\n\tif vtable != nil && vtable.Type == vindexes.TypeReference {","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/workflow/resharder.go#L223-L259","documentation":"blsIsReference determines whether a stream's BinlogSource filters reference or sharded tables. A reshard can only migrate streams that are homogeneous in this respect. If a stream's rules indicate sharded tables after a reference table was already seen, the operation is rejected with this error since reference and sharded streams require different handling in resharding.","triggerScenarios":"A single VReplication stream's BinlogSource rule list contains a mix of rules matching reference tables and rules matching sharded (non-reference) tables, detected while classifying streams during resharding.","commonSituations":"A filter (e.g. from a MoveTables workflow) was edited to add or remove tables changing its type; a workflow was configured against a schema where the same filter matches both reference and sharded tables; vschema changes reclassified tables.","solutions":["Split the stream into separate workflows: one for reference tables, one for sharded tables.","Update the stream's filter so its rules cover only one table type.","Re-run the reshard/migration after the streams are homogeneous."],"exampleFix":"// before: one stream mixing reference and sharded tables in rules\nrules: [{match: \"ref_table\"}, {match: \"sharded_table\"}]\n// after: separate streams\nstream1 rules: [{match: \"ref_table\"}]\nstream2 rules: [{match: \"sharded_table\"}]","handlingStrategy":"validation","validationCode":"-- Check each stream's filter matches only one table type via the vschema\nSELECT id, workflow, filter FROM _vt.vreplication; -- cross-check rule matches against vschema table types","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"mix of reference and sharded tables\") {\n    // split the offending stream's filter, then retry\n}","preventionTips":["Keep each VReplication stream's filter homogeneous (all reference or all sharded)","Re-evaluate streams after vschema table-type changes","Avoid editing MoveTables filters to mix reference and sharded tables"],"tags":["vreplication","resharding","reference-tables","validation"],"backgroundTag":"vreplication-mixed-reference-sharded-streams","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}