{"record":{"id":"185e13a3b80b9188","repo":"vitessio/vitess","slug":"lookup-update-convert-v","errorCode":null,"errorMessage":"lookup.Update.convert: %v","messagePattern":"lookup\\.Update\\.convert: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtgate/vindexes/lookup_unicodeloosemd5_hash.go","lineNumber":405,"sourceCode":"\tif err != nil {\n\t\treturn fmt.Errorf(\"lookup.Delete.vunhash: %v\", err)\n\t}\n\trowsColValues, err = convertRows(rowsColValues)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"lookup.Delete.convert: %v\", err)\n\t}\n\treturn lhu.lkp.Delete(ctx, vcursor, rowsColValues, sqltypes.NewUint64(v), vtgatepb.CommitOrder_NORMAL)\n}\n\n// Update updates the entry in the vindex table.\nfunc (lhu *LookupUnicodeLooseMD5HashUnique) Update(ctx context.Context, vcursor VCursor, oldValues []sqltypes.Value, ksid []byte, newValues []sqltypes.Value) error {\n\tv, err := vunhash(ksid)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"lookup.Update.vunhash: %v\", err)\n\t}\n\tnewValues, err = convertIds(newValues)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"lookup.Update.convert: %v\", err)\n\t}\n\toldValues, err = convertIds(oldValues)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"lookup.Update.convert: %v\", err)\n\t}\n\treturn lhu.lkp.Update(ctx, vcursor, oldValues, ksid, sqltypes.NewUint64(v), newValues)\n}\n\n// MarshalJSON returns a JSON representation of LookupHashUnique.\nfunc (lhu *LookupUnicodeLooseMD5HashUnique) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(lhu.lkp)\n}\n\n// IsBackfilling implements the LookupBackfill interface\nfunc (lhu *LookupUnicodeLooseMD5HashUnique) IsBackfilling() bool {\n\treturn lhu.writeOnly\n}\n","sourceCodeStart":387,"sourceCodeEnd":423,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtgate/vindexes/lookup_unicodeloosemd5_hash.go#L387-L423","documentation":"LookupUnicodeLooseMD5Hash.Update converts new column values to the vindex's key format before delegating to the underlying lookup. If convertIds fails on the new values (e.g. a value cannot be converted to bytes/hash input), this wrapped error is returned and the update is aborted.","triggerScenarios":"UPDATE on a table with a lookup_unicodeloosemd5_hash vindex where the new value for the vindex column cannot be converted by convertIds (unconvertible type, e.g. binary/blob value for a unicode-hash vindex).","commonSituations":"Updating the vindex column to a value of an unexpected SQL type (BLOB/binary) that has no string conversion; schema mismatch between the column type expected by the vindex config and the actual table column.","solutions":["Check the new value's SQL type — use a text/varchar-compatible type for unicode hash vindexes.","CAST the value to a compatible string type in the UPDATE statement.","Verify the vindex definition in the vschema matches the column type."],"exampleFix":"// before\nUPDATE t SET email = UNHEX('...') WHERE id = 1;\n// after\nUPDATE t SET email = CAST(UNHEX('...') AS CHAR) WHERE id = 1;","handlingStrategy":"validation","validationCode":"if _, err := convertIds(newValues); err != nil {\n    return fmt.Errorf(\"new vindex values not convertible: %v\", err)\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"lookup.Update.convert\") {\n    // check column type vs vindex type; CAST values to string\n}","preventionTips":["Match column SQL types (VARCHAR/TEXT) to the unicode/hash vindex expectations.","CAST binary values to CHAR before assigning to vindex columns.","Validate vschema vindex type against actual column types after schema changes."],"tags":["vtgate","vindex","lookup","update","type-conversion"],"backgroundTag":"vindex-value-conversion-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}