Fix “Cannot use object of type WP_Error as array” in WPForms CacheBase.php

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.

Why this error shows up

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:

  • Call a function that can return WP_Error.
  • Assume the result is an array and access $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.

Step 1: Get back into your dashboard

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.

Option A: Use WordPress Recovery Mode

  1. Check the admin email inbox for a message titled “Your Site Is Experiencing a Technical Issue”.
  2. Click the recovery link in that email.
  3. Log in. WordPress will temporarily pause the failing plugin (WPForms) so you can access the dashboard.

Option B: Rename the WPForms plugin folder

  1. Open your hosting file manager or connect with FTP/SFTP.
  2. Go to wp-content/plugins/.
  3. Rename the wpforms-lite folder (or wpforms if you use Pro) to something like wpforms-lite-temp.
  4. Reload /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.

Step 2: Update WPForms to a fixed version

The first real fix is to make sure you are not running a version with the known bug.

Do this:

  1. In WordPress, go to Dashboard → Updates and click Check again.
  2. Go to Plugins → Installed Plugins and find:
    • WPForms Lite or WPForms (Pro)
  3. If an update is available, click Update now.
  4. Make sure your version is at least:
    • WPForms Lite 1.8.9.1 or higher, or
    • The latest Pro version if you use WPForms Pro.
  5. Reactivate WPForms.

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.

Step 3: Reinstall WPForms to repair corrupted files

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.

Do this (your forms will not be deleted):

  1. In Plugins → Installed Plugins, deactivate WPForms.
  2. Click Delete under the WPForms entry.This removes the plugin files but keeps your forms and entries in the database.
  3. Go to Plugins → Add New, search for WPForms, and click Install Now, then Activate.
  4. If you use WPForms Pro, upload the latest .zip from your WPForms account under Plugins → Add New → Upload Plugin, then activate it.
  5. Clear any caching plugin or server cache, then reload the admin area.

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.

Step 4: Make sure WPForms can write and reach what it needs

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).

4.1 Check the WPForms cache folder permissions

CacheBase writes small JSON files into a cache folder.

  • Using FTP or your file manager, go to wp-content/uploads/wpforms/.
  • Make sure any cache subfolder exists and is writable by the web server user.
  • On typical Linux hosting that means ownership like 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.

4.2 Check for general WP_Error sources

If you see a lot of different WP_Error messages in debug.log around the same time, fix those too. Common causes:

  • Outgoing HTTP requests failing because of cURL or SSL configuration problems.
  • Firewall rules blocking requests from your site to wpforms.com or other APIs.
  • Disk space limits causing file operations to fail.

The fewer underlying errors your server throws, the less often WPForms has to handle WP_Error internally.

Step 5: Developer notes for custom code

If you or your developer extend WPForms or hook into its caching, you might create similar errors yourself.

  • Any time you call a function that can return 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'];
  • Do not assume third party filters attached to WPForms always return arrays. Validate before you index into them.

If your own code is adding filters that interact with CacheBase, double check those callbacks for missing is_wp_error() checks.

If you cannot tell whether the bug is fixed

At this point you should have:

  • Updated or reinstalled WPForms to a fixed version.
  • Confirmed there is only one WPForms plugin folder.
  • Checked permissions on the uploads/wpforms/ cache folder.

If the error still appears, I will need a bit more context.

Scroll down, click Continue Chat, and send me:

  1. The exact fatal error line from debug.log (including the full file path and line number).
  2. Your versions of:
    • WordPress
    • WPForms Lite or WPForms Pro
    • Your PHP version (7.4, 8.1, 8.2, and so on)
  3. Whether you are on shared hosting, managed hosting, or your own VPS.
  4. Any security, firewall, or caching plugins currently active.

Verification: how to know it is fixed

You are in good shape when:

  • You can log in to wp admin without hitting a critical error.
  • Your debug.log no longer records new Cannot use object of type WP_Error as array entries from CacheBase.php.
  • WPForms forms load and submit as expected.
  • There is only one WPForms plugin installed and it is on a current version.

Still stuck?

For AI help

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.

For expert human help

Scroll down to the contact form below. Enter your name, email, and WordPress needs. Atiba will get back to you as soon as possible.

Need human WordPress help?

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!