{"record":{"id":"d3d8d7bf6fbca36f","repo":"vitessio/vitess","slug":"unable-to-create-vdiff-for-uuid-s-on-tablet-s","errorCode":null,"errorMessage":"unable to create vdiff for UUID %s on tablet %s (%w)","messagePattern":"unable to create vdiff for UUID (.+?) on tablet (.+?) \\(%w\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vttablet/tabletmanager/vdiff/action.go","lineNumber":229,"sourceCode":"\t\t\tstate = StoppedState\n\t\t}\n\t\tquery, err := sqlparser.ParseAndBind(sqlNewVDiff,\n\t\t\tsqltypes.StringBindVariable(req.Keyspace),\n\t\t\tsqltypes.StringBindVariable(req.Workflow),\n\t\t\tsqltypes.StringBindVariable(string(state)),\n\t\t\tsqltypes.StringBindVariable(string(optionsJSON)),\n\t\t\tsqltypes.StringBindVariable(vde.thisTablet.Shard),\n\t\t\tsqltypes.StringBindVariable(topoproto.TabletDbName(vde.thisTablet)),\n\t\t\tsqltypes.StringBindVariable(req.VdiffUuid),\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\tif qr.InsertID == 0 {\n\t\t\treturn fmt.Errorf(\"unable to create vdiff for UUID %s on tablet %s (%w)\",\n\t\t\t\treq.VdiffUuid, topoproto.TabletAliasString(vde.thisTablet.Alias), err)\n\t\t}\n\t\tresp.Id = int64(qr.InsertID)\n\t} else {\n\t\tif !recordFound {\n\t\t\treturn fmt.Errorf(\"vdiff with UUID %s not found on tablet %s\",\n\t\t\t\treq.VdiffUuid, topoproto.TabletAliasString(vde.thisTablet.Alias))\n\t\t}\n\t\tif resp.Id, err = qr.Named().Row().ToInt64(\"id\"); err != nil {\n\t\t\treturn fmt.Errorf(\"vdiff found with invalid id on tablet %s: %w\",\n\t\t\t\ttopoproto.TabletAliasString(vde.thisTablet.Alias), err)\n\t\t}\n\t\texecResume := func(query string) (rowsAffected uint64, err error) {\n\t\t\tquery, err = sqlparser.ParseAndBind(query,\n\t\t\t\tsqltypes.StringBindVariable(req.VdiffUuid),\n\t\t\t\tsqltypes.StringBindVariable(vde.dbName),\n\t\t\t)\n\t\t\tif err != nil {","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vttablet/tabletmanager/vdiff/action.go#L211-L247","documentation":"After executing the INSERT that creates the vdiff record, Vitess checks qr.InsertID; if it is 0 the insert did not actually create a row, so it reports that vdiff creation failed, wrapping the underlying error. This guards against inserts that silently affected no rows.","triggerScenarios":"The INSERT into _vt.vdiff_tablet returns InsertID == 0 — e.g. the query executed but inserted nothing due to table schema issues, or the wrapped err context (like a MySQL error surfaced as 0 rows) — inside handleCreateResumeAction on a vdiff create.","commonSituations":"_corrupt or mismatched _vt.vdiff_tablet schema on the tablet; MySQL-level errors during the insert; replica tablets whose local schema lags behind the vitess metadata migration.","solutions":["Check the wrapped error (%w) in the message for the root MySQL cause","Verify _vt.vdiff_tablet schema is current (run online DDL / schema migration checks) on the tablet","Re-run the vdiff create after fixing the underlying error","Ensure the target tablet is healthy (serving, not in a failed migration state)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// ensure _vt.vdiff_tablet exists and is writable on the tablet before creating vdiffs","typeGuard":null,"tryCatchPattern":"var insertErr error\nif strings.Contains(err.Error(), \"unable to create vdiff\") {\n    insertErr = err // inspect wrapped %w cause for the MySQL-level failure\n    log.Errorf(\"vdiff create failed: %v\", insertErr)\n}","preventionTips":["Keep tablet _vt schema migrations current","Ensure target tablets are healthy and serving before vdiff create","Surface and log the wrapped error for root cause"],"tags":["vdiff","mysql","insert-failed"],"backgroundTag":"insert-affected-zero-rows","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}