vitessio/vitess · error

vdiff found with invalid id on tablet %s: %w

Error message

vdiff found with invalid id on tablet %s: %w

What it means

The vdiff row was found, but its `id` column could not be converted to an int64 while building the response, indicating a corrupt or unexpected id value in _vt.vdiff_tablet. The error wraps the conversion failure.

Source

Thrown at go/vt/vttablet/tabletmanager/vdiff/action.go:239

		)
		if err != nil {
			return err
		}
		if qr, err = dbClient.ExecuteFetch(query, 1); err != nil {
			return err
		}
		if qr.InsertID == 0 {
			return fmt.Errorf("unable to create vdiff for UUID %s on tablet %s (%w)",
				req.VdiffUuid, topoproto.TabletAliasString(vde.thisTablet.Alias), err)
		}
		resp.Id = int64(qr.InsertID)
	} else {
		if !recordFound {
			return fmt.Errorf("vdiff with UUID %s not found on tablet %s",
				req.VdiffUuid, topoproto.TabletAliasString(vde.thisTablet.Alias))
		}
		if resp.Id, err = qr.Named().Row().ToInt64("id"); err != nil {
			return fmt.Errorf("vdiff found with invalid id on tablet %s: %w",
				topoproto.TabletAliasString(vde.thisTablet.Alias), err)
		}
		execResume := func(query string) (rowsAffected uint64, err error) {
			query, err = sqlparser.ParseAndBind(query,
				sqltypes.StringBindVariable(req.VdiffUuid),
				sqltypes.StringBindVariable(vde.dbName),
			)
			if err != nil {
				return 0, err
			}
			if qr, err = dbClient.ExecuteFetch(query, 1); err != nil {
				return 0, err
			}
			return qr.RowsAffected, nil
		}
		rowsAffected, err := execResume(sqlResumeVDiff)
		if err != nil {
			return err

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Inspect the row: SELECT id, uuid FROM _vt.vdiff_tablet WHERE uuid='<uuid>' on the tablet
  2. Fix or delete the corrupt row and re-create the vdiff
  3. Verify the tablet's _vt.vdiff_tablet schema matches the expected Vitess schema for your version
  4. Check tablet replication health if the local _vt table diverged

Example fix

// repair a corrupt row
mysql> DELETE FROM _vt.vdiff_tablet WHERE uuid='bad-uuid' AND id IS NULL;
// then re-create the vdiff
Defensive patterns

Strategy: type-guard

Validate before calling

row := qr.Named().Row()
if row == nil { return errors.New("no vdiff row") }
if _, err := row["id"].ToInt64(); err != nil { return fmt.Errorf("corrupt vdiff id: %w", err) }

Type guard

func hasValidVDiffID(row sqltypes.RowNamed) bool {
    if row == nil { return false }
    _, err := row["id"].ToInt64()
    return err == nil
}

Try / catch

if strings.Contains(err.Error(), "found with invalid id") {
    // inspect/repair the _vt.vdiff_tablet row before proceeding
}

Prevention

When it happens

Trigger: qr.Named().Row().ToInt64("id") fails during handleCreateResumeAction — e.g. NULL id, non-numeric value, or missing `id` column in the row returned from _vt.vdiff_tablet.

Common situations: Manual edits or corrupted rows in the _vt.vdiff_tablet table; schema drift where the id column was altered/dropped by a failed migration; replication inconsistencies on a replica tablet's local _vt table.

Related errors


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