Common SQL Errors

MySQL Error 3129: ER_WARN_ON_MODIFYING_GTID_EXECUTED_TABLE - How to Fix and Prevent

Galaxy Team
August 8, 2025

MySQL raises ER_WARN_ON_MODIFYING_GTID_EXECUTED_TABLE when a user tries to INSERT, UPDATE, or DELETE rows in mysql.gtid_executed, an internal table that tracks executed GTIDs.

Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

What is MySQL error 3129 ER_WARN_ON_MODIFYING_GTID_EXECUTED_TABLE?

ER_WARN_ON_MODIFYING_GTID_EXECUTED_TABLE warns that you attempted to change mysql.gtid_executed, a protected system table holding GTID history. Stop modifying the table directly and use standard transactional workflows or GTID utilities to correct the issue.

Error Highlights

Typical Error Message

ER_WARN_ON_MODIFYING_GTID_EXECUTED_TABLE

Error Type

System Table Modification Warning

Language

MySQL

Symbol

internal system table to store GTIDs for committed transactions. Modifying it can lead to an inconsistent GTID state. ER_WARN_ON_MODIFYING_GTID_EXECUTED_TABLE was added in 5.7.8.

Error Code

3129

SQL State

HY000

Explanation

Table of Contents

What is MySQL error 3129 ER_WARN_ON_MODIFYING_GTID_EXECUTED_TABLE?

MySQL error 3129 appears when a session issues INSERT, UPDATE, DELETE, or TRUNCATE against the mysql.gtid_executed table. This table is maintained internally to record the Global Transaction Identifiers (GTIDs) of every committed transaction.

GTIDs are central to replication consistency. Any manual change can corrupt the GTID set, break replication, and cause data divergence. MySQL therefore blocks the operation and emits the ER_WARN_ON_MODIFYING_GTID_EXECUTED_TABLE warning instead.

What Causes This Error?

User code or maintenance scripts that run DML against mysql.gtid_executed trigger the warning. This often occurs when engineers explore system tables without understanding their role.

Another common cause is a mis-crafted migration script that tries to purge GTID rows to "reset" replication. Since 5.7.8, MySQL protects the table to prevent these unsafe operations.

How to Fix ER_WARN_ON_MODIFYING_GTID_EXECUTED_TABLE

Immediately stop modifying mysql.gtid_executed. Revert any code, cron job, or migration that runs DML against the table.

If you need to adjust GTID sets, use MySQL's built-in commands such as RESET MASTER, RESET SLAVE ALL, or mysqlbinlog with --exclude-gtids. Always perform these steps during maintenance windows.

Common Scenarios and Solutions

Scenario: A DBA wants to reclaim space by purging GTIDs. Solution: Run PURGE BINARY LOGS and let MySQL update mysql.gtid_executed automatically.

Scenario: A failed replication cluster needs GTID realignment. Solution: Use START SLAVE UNTIL SQL_BEFORE_GTIDS or SET GTID_PURGED, not manual table edits.

Best Practices to Avoid This Error

Grant developers read-only access to mysql schema objects. Reserve SUPER and SYSTEM_VARIABLES_ADMIN for DBAs.

Automate replication maintenance with vetted tools like mysqlshell or orchestrator. Never hand-edit system tables.

Related Errors and Solutions

Error 1840 (ER_CANT_SET_GTID_PURGED_WHEN_GTID_MODE_IS_OFF) occurs when you run SET GTID_PURGED with GTID_MODE disabled. Enable GTID_MODE before issuing the command.

Error 1782 (ER_MASTER_INFO) surfaces if replication metadata tables are corrupted. Recreate the slave with CHANGE MASTER TO and START SLAVE.

Common Causes

Misunderstanding System Tables

Developers exploring internal schemas may test DML statements on mysql.gtid_executed, triggering the warning.

DIY Replication Resets

Scripts that manually delete GTID rows to "reset" replication state raise error 3129.

Automated Tools with Bugs

Outdated backup or migration utilities might still attempt direct writes to mysql.gtid_executed.

Related Errors

Error 1840 ER_CANT_SET_GTID_PURGED_WHEN_GTID_MODE_IS_OFF

Occurs when trying to purge GTIDs while GTID mode is disabled.

Error 1782 ER_MASTER_INFO

Indicates corrupted replication metadata tables.

Error 1776 ER_GTID_PURGED_WAS_CHANGED

Happens if SET GTID_PURGED is reissued with a different value.

FAQs

Can I ever modify mysql.gtid_executed directly?

No. Always use official MySQL commands to adjust GTIDs. Direct DML risks replication corruption.

Does this error stop my query?

MySQL emits a warning, but the DML is ignored. Your session should treat it as a failure and exit.

How do I reset GTIDs safely?

Execute RESET MASTER on the primary or use SET GTID_PURGED during logical export/import processes.

How does Galaxy help prevent this error?

Galaxy's AI copilot flags DML against system tables in real time and suggests safer built-in commands, preventing accidental GTID corruption.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo