An automation saves without complaint in plain text, then fails the moment you switch it to custom HTML: “Fatal error while saving automation, Failed to set data for key _action”. Raising PHP packet sizes does not help and debug logging produces nothing useful, which is why this one is usually chased in the wrong place.
What causes the fatal error while saving automation
The cause sits in the database, not in the plugin. The error appears only when the automation contains custom HTML, because that content can carry four-byte characters such as emojis, and a database running UTF8mb3 encoding cannot store them. Changing the encoding to UTF8MB4 resolves it. The sections below show how the case was diagnosed, so you can confirm it matches your own symptoms before touching anything.
Situation/Challenge Description – Fatal Error While Saving Automation
Our client reported an issue when trying to save an email automation in the ShopMagic plugin. The error message “Fatal error while saving automation, Failed to set data for key _action” appeared only when he tried to set up an email with custom HTML (using the “Send Email” or “Raw HTML” options). Emails in “Plain Text” format worked fine.
Client had already changed PHP settings to allow larger packet sizes, but the problem still occurred. He also enabled debugging, but no useful information appeared in the logs.
Case Analysis and Solution for Fatal Error While Saving Automation
Step 1: Understand the Problem
We thought the issue might be related to incorrect database encoding, especially when emojis or special characters were used in the email. These types of errors often occur due to incompatible encoding that does not support certain characters.
Step 2: Test the Solution
We asked the client to perform several tests:
- Check if the problem still occurs with only WooCommerce and ShopMagic active, while disabling all other plugins.
- Review the database settings to ensure the encoding supports emojis and other characters.
Step 3: Final Solution
After reviewing the case, we found that the problem was caused by incorrect database encoding. Client used a database with UTF8mb3 encoding, which did not support characters like emojis. Once we changed the database encoding to UTF8MB4, the problem was solved.
Practical Tip:
Before using ShopMagic to send emails with custom HTML, make sure your database uses UTF8MB4 encoding. This encoding supports all characters, including emojis, and prevents issues when saving automations.
Summary and Conclusions
The error “Fatal error while saving automation, Failed to set data for key _action” appears when a ShopMagic automation is saved with custom HTML content, through either the Send Email or the Raw HTML option. Automations in plain text save normally, and that contrast is what points at the cause.
It is not a PHP limit. Increasing packet sizes changes nothing, and debug logging produces no entry that explains the failure, so the usual troubleshooting path leads nowhere.
The cause is database encoding. UTF8mb3 cannot store four-byte characters such as emojis, and custom HTML content often contains them. Converting the database to UTF8MB4 removes the error.
Checking the encoding before building HTML automations is the whole prevention. On a database already running UTF8MB4, this failure cannot occur.
Check all the features of the plugin in our demo.
ShopMagic PRO £69
Free Follow-Up Emails & Marketing Automation for WooCommerce
Add to cart or View Details

\