Title: SQL error on indexing
Last modified: July 27, 2021

---

# SQL error on indexing

 *  Resolved [jmb1091](https://wordpress.org/support/users/jmb1091/)
 * (@jmb1091)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/sql-error-on-indexing/)
 * My error log is filled with SQL-related errors and Yoast seems unable to index
   content. I’ve tried using WP CLI to reset the index and re-index but the errors
   persist. Only one line is successfully inserted into the table, then every subsequent
   insert fails with an error like the following (redacted):
    `WordPress database
   error Duplicate entry '0' for key 'PRIMARY' for query INSERT INTO wp_*****_yoast_indexable(
   object_id, object_type, permalink, title, description, is_cornerstone, is_robots_noindex,
   is_robots_nofollow, is_robots_noarchive, is_robots_noimageindex, is_robots_nosnippet,
   is_public, has_public_posts, blog_id, open_graph_image, open_graph_image_id, 
   open_graph_image_source, open_graph_image_meta, twitter_image, twitter_image_id,
   twitter_image_source, permalink_hash, created_at, updated_at) VALUES ('7', 'user','
   https://****/author/****/', NULL, NULL, '0', '0', NULL, NULL, NULL, NULL, NULL,'
   0', '1', 'https://1.gravatar.com/avatar/*****?s=500&d=mm&r=g', NULL, 'gravatar-
   image', NULL, 'https://1.gravatar.com/avatar/*****?s=500&d=mm&r=g', NULL, 'gravatar-
   image', '51:ba05f9dd52d2a7327be4ebb59b02f3a3', '2021-07-27 01:14:03', '2021-07-
   27 01:14:03') made by require_once('/usr/local/wp/php/wp-cli.php'), WP_CLI\bootstrap,
   WP_CLI\Bootstrap\LaunchRunner->process, WP_CLI\Runner->start, WP_CLI\Runner->
   run_command_and_exit, WP_CLI\Runner->run_command, WP_CLI\Dispatcher\Subcommand-
   >invoke, call_user_func, WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{
   closure}, call_user_func, Yoast\WP\SEO\Commands\Index_Command->index, Yoast\WP\
   SEO\Commands\Index_Command->run_indexation_actions, Yoast\WP\SEO\Commands\Index_Command-
   >run_indexation_action, Yoast\WP\SEO\Actions\Indexing\Indexable_Post_Indexation_Action-
   >index, Yoast\WP\SEO\Repositories\Indexable_Repository->find_by_id_and_type, 
   Yoast\WP\SEO\Builders\Indexable_Builder->build_for_id_and_type, Yoast\WP\SEO\
   Builders\Indexable_Builder->save_indexable, do_action('wpseo_save_indexable'),
   WP_Hook->do_action, WP_Hook->apply_filters, Yoast\WP\SEO\Integrations\Watchers\
   Indexable_Post_Watcher->updated_indexable, Yoast\WP\SEO\Integrations\Watchers\
   Indexable_Post_Watcher->update_has_public_posts, Yoast\WP\SEO\Repositories\Indexable_Repository-
   >find_by_id_and_type, Yoast\WP\SEO\Builders\Indexable_Builder->build_for_id_and_type,
   Yoast\WP\SEO\Builders\Indexable_Builder->save_indexable, Yoast\WP\SEO\Models\
   Indexable->save, Yoast\WP\Lib\Model->save, Yoast\WP\Lib\ORM->save, Yoast\WP\Lib\
   ORM::execute`
 * This site is using the Divi theme.
    -  This topic was modified 4 years, 10 months ago by [jmb1091](https://wordpress.org/support/users/jmb1091/).
      Reason: Fixed code formatting

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Support [Michael Tiña](https://wordpress.org/support/users/mikes41720/)
 * (@mikes41720)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/sql-error-on-indexing/#post-14704363)
 * Hi [@jmb1091](https://wordpress.org/support/users/jmb1091/)
 * Could you please check if you are using the latest version of WP 5.8, Yoast SEO
   16.7, the latest version of your other plugins and themes, and that you are meeting
   all of the necessary [plugin requirements](https://yoast.com/help/plugin-requirements/)?
 * Can you please try resetting our indexables in the database tables by following
   the steps below?
 * 1. Install & activate the Yoast Test Helper plugin
    2. Go to Tools > Yoast Test
   3. Locate the Yoast SEO section and click on the ‘Reset indexables tables & migrations’,‘
   Reset Prominent words calculation’, and ‘Reset Internal link counter’ buttons.
   After each click, the page will reload to confirm that each reset was successful.
   Note: this won’t actually erase your SEO data, which is also stored in WordPress’
   default tables. It’ll just reset our index (custom tables) for that data. 4. 
   Go to SEO > Tools, and under SEO data, click the “Start SEO data optimization”
   button to allow Yoast to rescan your content. (or you can choose to run the indexables
   process [via WP-CLI](https://developer.yoast.com/features/wp-cli/reindex-indexables/),
   but you’ll still need to run the SEO data optimization process for the text link
   counter and prominent words calculation)
 * For your site’s health and safety, we recommend creating regular backups of your
   site and database. This is especially important before installing, updating or
   removing plugins. Learn more about the benefits of regular backups.
 * Could you please check if this helps resolve the issue once the SEO data optimization
   process completes?
 *  Thread Starter [jmb1091](https://wordpress.org/support/users/jmb1091/)
 * (@jmb1091)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/sql-error-on-indexing/#post-14707700)
 * Hi Michael,
 * Thanks for the reply. I think the additional steps of “Reset prominent words 
   calculation” and “Reset internal link counter” must have helped, because this
   time the indexing seems to be running correctly.
 * Many thanks!
 * -Joe

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘SQL error on indexing’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-seo/assets/icon-256x256.gif?rev=3419908)
 * [Yoast SEO - Advanced SEO with real-time guidance and built-in AI](https://wordpress.org/plugins/wordpress-seo/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-seo/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-seo/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-seo/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-seo/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-seo/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [jmb1091](https://wordpress.org/support/users/jmb1091/)
 * Last activity: [4 years, 10 months ago](https://wordpress.org/support/topic/sql-error-on-indexing/#post-14707700)
 * Status: resolved