{"record":{"id":"4765e639fd309b95","repo":"vitessio/vitess","slug":"too-many-vdiffs-found-d-for-uuid-s-keyspace-s","errorCode":null,"errorMessage":"too many vdiffs found (%d) for UUID %s keyspace %s and workflow %s on tablet %s","messagePattern":"too many vdiffs found \\((.+?)\\) for UUID (.+?) keyspace (.+?) and workflow (.+?) on tablet (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vttablet/tabletmanager/vdiff/action.go","lineNumber":352,"sourceCode":"\t\t\treturn err\n\t\t}\n\t\tif qr, err = dbClient.ExecuteFetch(query, 1); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tswitch len(qr.Rows) {\n\t\tcase 0:\n\t\t\treturn fmt.Errorf(\"no vdiff found for UUID %s keyspace %s and workflow %s on tablet %s\",\n\t\t\t\tvdiffUUID, req.Keyspace, req.Workflow, topoproto.TabletAliasString(vde.thisTablet.Alias))\n\t\tcase 1:\n\t\t\trow := qr.Named().Row()\n\t\t\tvdiffID, _ := row[\"id\"].ToInt64()\n\t\t\tsummary, err := vde.getVDiffSummary(vdiffID, dbClient, req.GetOptions().GetReportOptions())\n\t\t\tresp.Output = summary\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"too many vdiffs found (%d) for UUID %s keyspace %s and workflow %s on tablet %s\",\n\t\t\t\tlen(qr.Rows), vdiffUUID, req.Keyspace, req.Workflow, topoproto.TabletAliasString(vde.thisTablet.Alias))\n\t\t}\n\t}\n\tswitch req.ActionArg {\n\tcase AllActionArg:\n\t\tquery, err := sqlparser.ParseAndBind(sqlGetMostRecentVDiffByKeyspaceWorkflow,\n\t\t\tsqltypes.StringBindVariable(req.Keyspace),\n\t\t\tsqltypes.StringBindVariable(req.Workflow),\n\t\t\tsqltypes.StringBindVariable(vde.dbName),\n\t\t\tsqltypes.Int64BindVariable(maxVDiffsToReport),\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif qr, err = dbClient.ExecuteFetch(query, -1); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tresp.Output = sqltypes.ResultToProto3(qr)","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vttablet/tabletmanager/vdiff/action.go#L334-L370","documentation":"This error is thrown by the vdiff engine's show-action handler on a vttablet when a query for a vdiff record by UUID returns more than one row. The _vt.vdiff table should hold at most one row per (keyspace, workflow, UUID) triple, so multiple matches indicate corrupt or duplicated vdiff state. The handler aborts rather than guessing which record to summarize.","triggerScenarios":"Calling PerformVDiffAction with Action=Show and ActionArg set to a UUID when sqlGetVDiffID (or the UUID lookup query) matches len(qr.Rows) > 1 rows in the _vt.vdiff table on the tablet.","commonSituations":"Manual inserts into _vt.vdiff during debugging or recovery; orphaned/duplicated rows left by a crashed or interrupted vdiff; running the show against a tablet whose local _vt schema was restored from an inconsistent backup.","solutions":["Inspect the _vt.vdiff table on the tablet: SELECT * FROM _vt.vdiff WHERE vdiff_uuid='<uuid>' and identify the duplicate rows.","Delete the stale/duplicate rows keeping the correct one (DELETE FROM _vt.vdiff WHERE id=<stale id>).","Re-run the vdiff from scratch: delete all vdiff rows for the workflow and issue a fresh VDiff Create.","If duplication came from a backup restore, pick a healthy tablet/shard and let vtctld vdiff operate against it."],"exampleFix":"// before (mysql on tablet)\nSELECT id, vdiff_uuid, workflow FROM _vt.vdiff WHERE vdiff_uuid='6ba7b810-...';\n-- returns 2 rows\n// after\nDELETE FROM _vt.vdiff WHERE id=42; -- keep the correct row\n-- then re-run: vtctldclient VDiff --keyspace ks --workflow wf show 6ba7b810-...","handlingStrategy":"validation","validationCode":"rows, _ := tabletClient.Query(\"SELECT COUNT(*) FROM _vt.vdiff WHERE vdiff_uuid='\"+uuid+\"'\")\nif rows[0][0].AsInt64() > 1 { // dedupe before issuing show\n  cleanupDuplicates(uuid)\n}","typeGuard":"func hasSingleVDiffRow(n int) bool { return n == 1 }","tryCatchPattern":null,"preventionTips":["Never manually insert rows into _vt.vdiff without deleting existing ones for the same UUID.","Check for duplicates with SELECT before issuing show against a recovered/restored tablet.","Use vtctldclient vdiff delete all + create rather than surgical row edits.","Verify tablet backups restore _vt.vdiff consistently."],"tags":["vdiff","mysql","duplicate-rows","workflow"],"backgroundTag":"vdiff-duplicate-state-rows","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}