{"record":{"id":"b4f9f2904d6c8bdb","repo":"vitessio/vitess","slug":"no-vdiff-table-found-for-s-on-tablet-v","errorCode":null,"errorMessage":"no vdiff table found for %s on tablet %v","messagePattern":"no vdiff table found for (.+?) on tablet (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vttablet/tabletmanager/vdiff/workflow_differ.go","lineNumber":403,"sourceCode":"\t\tcase <-ctx.Done():\n\t\t\treturn vterrors.Errorf(vtrpcpb.Code_CANCELED, \"context has expired\")\n\t\tcase <-wd.ct.done:\n\t\t\treturn ErrVDiffStoppedByUser\n\t\tdefault:\n\t\t}\n\t\tquery, err := sqlparser.ParseAndBind(sqlGetVDiffTable,\n\t\t\tsqltypes.Int64BindVariable(wd.ct.id),\n\t\t\tsqltypes.StringBindVariable(td.table.Name),\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tqr, err := dbClient.ExecuteFetch(query, 1)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(qr.Rows) == 0 {\n\t\t\treturn fmt.Errorf(\"no vdiff table found for %s on tablet %v\",\n\t\t\t\ttd.table.Name, wd.ct.vde.thisTablet.Alias)\n\t\t}\n\n\t\tlog.Info(fmt.Sprintf(\"Starting diff of table %s for vdiff %s\", td.table.Name, wd.ct.uuid))\n\t\tif err := wd.diffTable(ctx, dbClient, td); err != nil {\n\t\t\treturn wd.markTableErrored(ctx, dbClient, td, err)\n\t\t}\n\t\tif err := td.updateTableState(ctx, dbClient, CompletedState); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlog.Info(fmt.Sprintf(\"Completed diff of table %s for vdiff %s\", td.table.Name, wd.ct.uuid))\n\t}\n\tif err := wd.markIfCompleted(ctx, dbClient); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n","sourceCodeStart":385,"sourceCodeEnd":421,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vttablet/tabletmanager/vdiff/workflow_differ.go#L385-L421","documentation":"When starting the diff, for each table in the plan vdiff queries the _vt.vdiff_table rows for this vdiff id. If no row exists for a table that is in the tableDiffers map, the internal state is inconsistent and this error is thrown before any diffing starts.","triggerScenarios":"A vdiff run whose expected per-table row in _vt.vdiff_table is missing on this tablet — e.g. the vdiff record was partially created, rows were deleted/cleaned concurrently, or the diff is being resumed against a tablet whose local vdiff state was wiped.","commonSituations":"Interruption during vdiff creation (vtctld crash between inserting the vdiff row and its table rows); manual cleanup of _vt.vdiff_table rows; running vdiff on a different target tablet than where state was created; upgrading Vitess mid-vdiff.","solutions":["Cancel the vdiff and start a fresh one (`CancelVExec`/`vd ct cancel` then re-run vdiff) so table rows are re-created","Inspect `_vt.vdiff_table` on the target primary for the vdiff id and confirm which rows are missing","Avoid manual deletes on _vt tables; if rows were removed, recreate the workflow's vdiff from scratch","Ensure vtctld and tablets are on compatible Vitess versions during the vdiff"],"exampleFix":"// vtctlclient\nvtctldclient VDiff -- tabletspec ... cancel <keyspace> <workflow>\nvtctldclient VDiff -- ... show <keyspace> <workflow>  # then re-run vdiff","handlingStrategy":"retry","validationCode":"// check per-table state exists before resuming\nqr, _ := dbClient.ExecuteFetch(fmt.Sprintf(\n  \"SELECT 1 FROM _vt.vdiff_table WHERE vdiff_id=%d AND table_name='%s'\", id, table), 1)\nif len(qr.Rows) == 0 { // state missing: cancel and restart vdiff instead of resuming }","typeGuard":"null","tryCatchPattern":"if err := wd.diff(ctx, dbClient); err != nil {\n  if strings.Contains(err.Error(), \"no vdiff table found for\") {\n    // cancel and start a fresh vdiff to rebuild per-table state\n    _ = wd.cancel(ctx)\n    return startFreshVDiff(ctx)\n  }\n  return err\n}","preventionTips":["Don't manually delete rows from _vt.vdiff_table","Run one vdiff at a time per workflow","Cancel and re-run vdiff after any interruption of its creation","Keep vtctld/tablets on compatible versions during a vdiff"],"tags":["vdiff","state","vdiff-table"],"backgroundTag":"vdiff-missing-table-state","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}