1464
MariaDBERRORNotableTransactionsHIGH confidence

XA transaction ID already exists

Production Risk

Medium — the new XA transaction cannot start; check for orphaned XA transactions.

What this means

ER_XAER_DUPID (1464, SQLSTATE HY000) is raised when an XA START is issued with an XID that is already in use by another XA transaction.

Why it happens
  1. 1Reusing an XA transaction ID that has not yet been committed or rolled back
  2. 2Application bug generating duplicate XID values
How to reproduce
trigger — this will error
trigger — this will error
XA START 'txn1';
-- Without completing or rolling back:
XA START 'txn1';  -- Duplicate XID

expected output

ERROR 1464 (HY000): XAID already exists

Fix

Complete or roll back the existing XA transaction first

Complete or roll back the existing XA transaction first
-- Check for existing XA transactions:
XA RECOVER;

-- Roll back the existing one:
XA ROLLBACK 'txn1';

-- Then start a new one:
XA START 'txn1';

Why this works

Each XA transaction must be completed (COMMIT or ROLLBACK) before its XID can be reused.

Sources
Official documentation ↗

MySQL 8.0 — 1464 ER_XAER_DUPID

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

← All MariaDB errors