{"record":{"id":"cd339e14c36edceb","repo":"vitessio/vitess","slug":"values-v-for-column-v-does-not-map-to-keyspace-i-cd339e","errorCode":null,"errorMessage":"values %v for column %v does not map to keyspace ids","messagePattern":"values (.+?) for column (.+?) does not map to keyspace ids","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtgate/engine/update.go","lineNumber":183,"sourceCode":"\t\t\t\t\tallNulls = key.IsNull()\n\t\t\t\t\tif !allNulls {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// All columns for this Vindex are set to null, so we can skip verification\n\t\t\t\tif allNulls {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// If values were supplied, we validate against keyspace id.\n\t\t\t\tverified, err := vindexes.Verify(ctx, colVindex.Vindex, vcursor, [][]sqltypes.Value{vindexColumnKeys}, [][]byte{ksid})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tif !verified[0] {\n\t\t\t\t\treturn fmt.Errorf(\"values %v for column %v does not map to keyspace ids\", vindexColumnKeys, colVindex.Columns)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (upd *Update) isVindexModified() bool {\n\treturn len(upd.ChangedVindexValues) != 0\n}\n\nfunc (upd *Update) description() PrimitiveDescription {\n\tother := map[string]any{\n\t\t\"Query\":                upd.Query,\n\t\t\"OwnedVindexQuery\":     upd.OwnedVindexQuery,\n\t\t\"MultiShardAutocommit\": upd.MultiShardAutocommit,\n\t\t\"QueryTimeout\":         upd.QueryTimeout,\n\t\t\"NoAutoCommit\":         upd.PreventAutoCommit,","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtgate/engine/update.go#L165-L201","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Rebuild the affected lookup vindex table (InsertIntoLookup / rebuild workflow) so it matches the base table.","Verify the row's vindex column values with the vindex mapping manually to find the inconsistent rows.","Check for concurrent writers or interrupted migrations that left the lookup partially updated.","Re-run the UPDATE once the lookup data is consistent."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// verify vindex consistency proactively\nok, err := vindex.Verify(ctx, vcursor, [][]sqltypes.Value{vals}, [][]byte{ksid})\nif err != nil || !ok[0] {\n    return errors.New(\"vindex out of sync; rebuild lookup before updating\")\n}","typeGuard":null,"tryCatchPattern":"err := vtgate.Execute(ctx, updateQuery)\nif err != nil && strings.Contains(err.Error(), \"does not map to keyspace ids\") {\n    // trigger lookup vindex rebuild / consistency check\n}","preventionTips":["Only modify vindexed tables through Vitess, never raw MySQL DML.","Schedule regular vindex consistency verification (vtctldclient workflows).","Rebuild lookup tables after restores or interrupted migrations."],"tags":["vtgate","vindex","lookup","data-consistency"],"backgroundTag":"vindex-verification-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}