WordPress Jetpack – Invalid Client, Unknown client_id

Invalid request, please go back and try again. Error Code:invalid_client Error Message: Unknown client_id.

Warning: This post has instructions that involve manipulating the WordPress database. This can break your site or result in data loss if not done properly. Take this actions at your own risk. Please back up your database before attempting this.

I received this error when attempting to activate the Jetpack WordPress plugin through the WordPress admin interface on a site I manage.

Invalid request, please go back and try again.

I don’t know exactly how I got the WordPress installation into this state. But I suspect its because I performed the following actions in the following order:

  • I installed the Jetpack plugin on the site, did not activate it.
  • I upgraded WordPress to 5.3.
  • I attempted to activate the Jetpack plugin.

Solution Overview

The resolve this error you must do the following:

  • Backup your database.
  • Deactivate the Jetpack plugin if it is activated.
  • Delete/Uninstall the Jetpack plugin.
  • Remove all Jetpack related entries from the wp_options table in your WordPress installation’s database.
  • Re-install and re-activate the Jetpack plugin.

Solution Details

Backup your database

Backing up your database is outside the scope of this post. There are many ways to backup a WordPress site or database. If you run a WordPress site you should ideally have regular backups running already.

Deactivate and delete Jetpack

The next two steps are fairly straight forward. Through the WordPress admin interface, deactivate and delete the plugin.

Remove Jetpack rows from the wp_options table

This is where things get a little more tricky. I provide two options to do this. The first is using PhpMyAdmin. PhPMyAdmin is a web based tool for working with SQL databases. If you are running WordPress on your own VPS or dedicated server you probably have this installed. If not the second option will show you how to use SQL statements via the MySQL CLI.

Remove Jetpack rows using PhpMyAdmin

Log into your PhPMyAdmin web interface. On my server its installed at https://servername.com/PhpMyAdmin.

On the left hand side pane, find the database for your WordPress site. Expand the database to see the list of tables and click on the wp_options table. This will show you a paginated view of the rows in that table.

Next click on the SQL button to run a SQL query. Paste the following SQL statement in the box:

SELECT * FROM `wp_options` WHERE `option_name` LIKE '%jetpack_%'

This query will return all rows that have “jetpack” in the option name.

SELECT all jetpack rows from wp_options

Next, click the show all check box. Then finally click the delete button at the bottom of the query. This will delete all of these rows.

Finally re-install Jetpack via the admin interface and re-activate it.

Remove Jetpack rows using MYSQL CLI

Typically you will be running the MySQL CLI from the server itself. So login to the server via SSH or whatever means you have. Next start the MySQL CLI and use the database you are working on. Substitute “username” for your MySQL username and enter the password when prompted. Then run the “use” command to switch to your database, substituting “databasename” for your WordPress database name.

mysql -u username -p
mysql>use databasename;

Next we are going to run a query that does two things:

  • Runs a query to get all rows from wp_options that have “jetpack” in them.
  • Delete those rows.

We are using sub-select or sub-query to do this. The code is as follows:

DELETE FROM wp_options WHERE id IN (
    SELECT * FROM (
        SELECT id FROM `wp_options` WHERE `option_name` LIKE '%jetpack_%'
    ) AS p
)

Now re-install and reactivate Jetpack.

Feedback?

Do you have feedback on how we can make this post better? Please leave a comment.