vitessio/vitess · error

values %v for column %v does not map to keyspace ids

Error message

values %v for column %v does not map to keyspace ids

What it means

During an UPDATE, after modifying rows, Vitess verifies that the owning vindex still maps the column values to the expected keyspace id. If verification fails, the values in the row are inconsistent with what the vindex lookup table/mapping says, so the update is aborted. This indicates data or vindex corruption rather than a normal user error.

Source

Thrown at go/vt/vtgate/engine/update.go:183

					allNulls = key.IsNull()
					if !allNulls {
						break
					}
				}

				// All columns for this Vindex are set to null, so we can skip verification
				if allNulls {
					continue
				}

				// If values were supplied, we validate against keyspace id.
				verified, err := vindexes.Verify(ctx, colVindex.Vindex, vcursor, [][]sqltypes.Value{vindexColumnKeys}, [][]byte{ksid})
				if err != nil {
					return err
				}

				if !verified[0] {
					return fmt.Errorf("values %v for column %v does not map to keyspace ids", vindexColumnKeys, colVindex.Columns)
				}
			}
		}
	}
	return nil
}

func (upd *Update) isVindexModified() bool {
	return len(upd.ChangedVindexValues) != 0
}

func (upd *Update) description() PrimitiveDescription {
	other := map[string]any{
		"Query":                upd.Query,
		"OwnedVindexQuery":     upd.OwnedVindexQuery,
		"MultiShardAutocommit": upd.MultiShardAutocommit,
		"QueryTimeout":         upd.QueryTimeout,
		"NoAutoCommit":         upd.PreventAutoCommit,

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Rebuild the affected lookup vindex table (InsertIntoLookup / rebuild workflow) so it matches the base table.
  2. Verify the row's vindex column values with the vindex mapping manually to find the inconsistent rows.
  3. Check for concurrent writers or interrupted migrations that left the lookup partially updated.
  4. Re-run the UPDATE once the lookup data is consistent.
Defensive patterns

Strategy: try-catch

Validate before calling

// verify vindex consistency proactively
ok, err := vindex.Verify(ctx, vcursor, [][]sqltypes.Value{vals}, [][]byte{ksid})
if err != nil || !ok[0] {
    return errors.New("vindex out of sync; rebuild lookup before updating")
}

Try / catch

err := vtgate.Execute(ctx, updateQuery)
if err != nil && strings.Contains(err.Error(), "does not map to keyspace ids") {
    // trigger lookup vindex rebuild / consistency check
}

Prevention

When it happens

Trigger: updateVindexEntries calls vindexes.Verify after updating a lookup/owning vindex and verified[0] is false — the new value does not map to the computed keyspace id in the lookup table.

Common situations: Lookup table out of sync with the base table (previous failed writes, manual DML, restore from backup without rebuilding the lookup); concurrent updates racing with the verify; running UPDATE with values that were never inserted through Vitess.

Related errors


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