An automated WordPress update has failed to complete

We use a git+composer strategy to manage our WordPress environments (start here for a series of posts about this) and therefore have WordPress auto-update disabled. Beyond that, Apache doesn’t have write to its own filesystem, so WordPress can’t update itself.

However, the update and upgrade buttons are still presented on the interface, and it’s possible to accidentally trigger the update process from there. When that happens, WordPress places itself in maintenance mode, tries to update itself, fails, and then takes itself back out of maintenance mode. It’s about 5-10 minutes of downtime depending on your caching strategy.

WordPress also leaves behind a memento in the form of a message displayed to every administrator (both network and site on multsite environments), informing them that “An automated WordPress update has failed to complete.” This message is easy to remove, but you may have to take multiple actions to do so.

Cleanup on aisle update

The first place to look is the root of your uploads folder. WordPress will have created one or more files named .maintenance and .no-maintenance. These are placeholders; the content looks like this:

1
<?php $upgrading = time(); ?>

This is the most common source of the message. These files are safe to remove and in most cases (and according to most guides) removing them will remove the message and resolve the issue.

The other possible source of the message is in the wp_site_options table, where the failed update may have set the auto_core_update_failed key. Use WP-CLI to verify whether this key exists. If it’s set, you’ll see something like this:

1
wp site option get auto_core_update_failed
1
2
3
4
5
6
7
8
array (
'attempted' => '5.3.4',
'current' => '5.3.2',
'error_code' => 'mkdir_failed_ziparchive',
'error_data' => NULL,
'timestamp' => 1594741256,
'retry' => false,
)

It’s safe to delete this option once you’ve examined it; normally it’s not set:

1
wp site option delete auto_core_update_failed

Removing the lingering hidden maintenance files and deleting that option, if it exists, should clear the message. If you’re still having problems, or if you’re reading this in the future and WordPress has changed, the maintenance_nag function controls this message.