1032
MySQLERRORNotableDMLHIGH confidence

Can't find record in table

Production Risk

High — indicates possible data corruption or replication divergence.

What this means

ER_KEY_NOT_FOUND (1032, SQLSTATE HY000) is raised when the storage engine cannot locate a row by its key during an UPDATE or DELETE. It often indicates table corruption or replication divergence.

Why it happens
  1. 1Table data is corrupt — index and row data are out of sync
  2. 2Replication applied an UPDATE/DELETE for a row that does not exist on the replica
  3. 3Manual row deletion bypassed the storage engine
How to reproduce
trigger — this will error
trigger — this will error
-- Typically seen during replication or after table corruption

expected output

ERROR 1032 (HY000): Can't find record in 'tablename'

Fix 1

Check and repair the table

WHEN Error occurs outside of replication context.

Check and repair the table
CHECK TABLE tablename;
REPAIR TABLE tablename;

Why this works

CHECK TABLE identifies corruption; REPAIR TABLE rebuilds the index to match the data file.

Fix 2

Skip or handle the replication error

WHEN Error appears on a replica during replication.

Skip or handle the replication error
-- For a single skipped event (use with care):
STOP SLAVE;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
START SLAVE;

Why this works

Skipping a single event lets replication continue, but investigate why the row was missing.

What not to do

Skip replication errors repeatedly without investigation

Repeated 1032 errors on a replica indicate the replica is diverging from the source; skipping compounds the data drift.

Sources
Official documentation ↗

MySQL 8.0 — 1032 ER_KEY_NOT_FOUND

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MySQL errors