Sometimes WordPress will crash with a critical error and your debug.log shows this line:
Uncaught Error: Cannot use object of type WP_Error as array
in /www/wp-content/plugins/wpforms-lite/src/Helpers/CacheBase.php:364
This does not mean all your forms are ruined. It means WPForms tried to treat a WP_Error object like an array inside its CacheBase helper, and PHP refused.
WPForms support has confirmed this as a bug in older WPForms Lite versions, fixed in 1.8.9.1 and later. Here is the original support thread. The fix is to update WPForms and repair the plugin files, then make sure your server is not constantly triggering WP_Error in the first place.
WPForms keeps crashing with “Uncaught Error: Cannot use object of type WP_Error as array in /wp-content/plugins/wpforms-lite/src/Helpers/CacheBase.php:364”. It happens on admin login sometimes. How do I fix this?
If you are wondering what is broken: it is not your form configuration. It is WPForms’ own caching helper tripping over a bug when something returns a WP_Error instead of the data it expects.
Many WordPress functions return a WP_Error object when something goes wrong (network issue, bad response, permission problem, and so on). Core expects developers to check with is_wp_error() before using the result. This is how WP_Error is designed to work.
In some older WPForms Lite versions, the CacheBase helper did this sort of thing internally:
WP_Error.$response['something'] anyway.When the result was actually WP_Error, PHP hit the line in CacheBase.php and threw:
Cannot use object of type WP_Error as array
WPForms support has acknowledged this and fixed it in WPForms Lite 1.8.9.1. Updating usually clears the fatal. The support thread confirms that the bug is fixed in 1.8.9.1.
If your site is showing “There has been a critical error on this website” and you cannot reach wp admin, start here. If you can already access the dashboard, skip to Step 2.
wp-content/plugins/.wpforms-lite folder (or wpforms if you use Pro) to something like wpforms-lite-temp./wp-admin. WordPress will treat WPForms as deactivated and let you in.Once you are in the dashboard, leave WPForms deactivated until you have updated it.
The first real fix is to make sure you are not running a version with the known bug.
Now log out and back in, and refresh a few admin pages where the error used to appear.
If the fatal error is gone: you can jump down to Verification.
If you still see the same error in debug.log: continue with a clean reinstall.
Sometimes the update process leaves you with a half updated plugin folder. A clean reinstall makes sure the CacheBase.php file and related classes are all from the same version.
.zip from your WPForms account under Plugins → Add New → Upload Plugin, then activate it.After this, check wp-content/plugins/wpforms-lite/src/Helpers/CacheBase.php (or the equivalent file in Pro) to confirm it is from the current version, and watch your debug.log for new entries.
The original bug is about WP_Error being handled badly, but many WP_Error objects are caused by environment issues (permission problems, network blocks, SSL issues).
CacheBase writes small JSON files into a cache folder.
wp-content/uploads/wpforms/.cache subfolder exists and is writable by the web server user.www-data:www-data and permissions such as 755 for folders and 644 for files.If file writes are blocked, WPForms may hit WP_Error more often when trying to create or update cache files.
If you see a lot of different WP_Error messages in debug.log around the same time, fix those too. Common causes:
The fewer underlying errors your server throws, the less often WPForms has to handle WP_Error internally.
If you or your developer extend WPForms or hook into its caching, you might create similar errors yourself.
WP_Error, wrap it in a guard like:
$response = wp_remote_get( $url );
if ( is_wp_error( $response ) ) {
// Log or handle the error.
return;
}
// Safe to treat as array.
$body = $response['body'];
If your own code is adding filters that interact with CacheBase, double check those callbacks for missing is_wp_error() checks.
At this point you should have:
uploads/wpforms/ cache folder.If the error still appears, I will need a bit more context.
Scroll down, click Continue Chat, and send me:
debug.log (including the full file path and line number).You are in good shape when:
debug.log no longer records new Cannot use object of type WP_Error as array entries from CacheBase.php.Hit Continue Chat below and I will help you read your error log, check WPForms versions, and pinpoint whether the remaining issue is the plugin, your theme, or the server environment.
Scroll down to the contact form below. Enter your name, email, and WordPress needs. Atiba will get back to you as soon as possible.
WP Assistant is a free tool created by Atiba Software, a WordPress design and development company located in Nashville, TN. If you need more personalized WordPress assistance let us know, and we’ll get back to you ASAP!