Troubleshooting Guide: ElasticPress ‘Something Went Wrong’ Error

If you’ve encountered the “Something went wrong” error while syncing the content stored on your website with the Elasticsearch server using the ElasticPress plugin, this guide is for you.

This message originates from WordPress and indicates that either a plugin on your site or your active theme has triggered a fatal error during the sync process, or a JavaScript error occurred while parsing the response.

If you initiated the sync from the WordPress Dashboard, you can check for more details in your browser’s console. If that doesn’t help, the problem is likely a fatal error. To identify what’s causing it, you have two options:

1. Use the WP-CLI command to Perform a Sync

The most straightforward way to identify the cause of the fatal error is to rerun the sync using the following WP-CLI command:

wp elasticpress sync --force --setup --show-errors --yes

If you are running ElasticPress network activated on a multisite, you may also need to add the --network-wide flag, depending on your requirements.

Executing this command will result in the output of the fatal error, along with the stack trace.

If you’re unfamiliar with running WP-CLI commands, proceed to the alternative option below.

2. Retrieve the Fatal Error from Your Site’s PHP Error Log

If a sync attempt initiated from the Dashboard fails, WordPress will record the fatal error in your site’s PHP error log. To check this, follow these steps:

  1. Navigate to your WordPress Dashboard > ElasticPress > Sync.
  2. Initiate a sync; if the “Delete and Start a Fresh Sync” button is visible, click it.
  3. The sync will fail, displaying the message “Something went wrong.”

Once the sync fails, refer to your hosting provider’s guidelines to locate your error log.

For your convenience, here are direct links to error log documentation for several hosting services:
View Error Log on WP Engine
View Error Log on Pantheon
View Error Log on Savvi Managed Hosting
View Error Log on Kinsta
View Error Log on Cloudways

Understanding Errors

Check below some of the most common errors.

Memory size errors

PHP message: PHP Fatal error: Allowed memory size of XXXXXXX bytes exhausted (tried to allocate XXX bytes) in path/to/plugin-theme/file

The above error indicates that your site is running out of memory during the sync process, causing premature termination. Check out our dedicated article about memory size errors.

Third-party plugins

PHP Fatal error: Uncaught TypeError: [PluginName]\[Path]::enable_assets(): Argument #1 ($assets_data) must be of type array, string given, called in [PluginName]/assets.php on line [LineNumber] and defined in [FileName].php:[LineNumber]
PHP Fatal error: Cannot declare class [ClassName], because the name is already in use in [FileName].php on line [LineNumber]

As evidenced by the errors, the issue originates from a third-party plugin or theme unrelated to ElasticPress. These external components generate fatal errors when ElasticPress tries to sync content that they either produce or modify.

Possible resolutions

In such cases, there is no universal solution. We recommend reaching out to the developers of the plugin or theme causing the issue. Mention that their plugin/theme is returning a fatal error when ElasticPress attempts to sync your site’s content.

Alternatively, you may try disabling the problematic plugin during the sync process if it doesn’t create a Custom Post Type (CPT) or add any “special content.”

By following these troubleshooting steps, you should be able to diagnose and resolve the sync issue related to ElasticPress.