Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is encountering a database error indicating a duplicate entry '0' for the primary key when trying to save a translation. This error suggests that AUTO INCREMENT may be deactivated on the database table.

Solution:
1. Check the

icl_translation_status

table in the database to ensure that AUTO INCREMENT is enabled.
2. If AUTO INCREMENT is not enabled, it needs to be activated. This may also require checking other WordPress tables like

wp_options

,

wp_posts

, and

wp_users

to ensure they have AUTO INCREMENT enabled where necessary.
3. If there is an entry with '0' in a table where you are trying to enable AUTO INCREMENT, you must remove that entry before you can enable AUTO INCREMENT.
4. Always ensure you have a recent and working backup before making any changes to the database.

Please note that this solution might not be relevant if it's outdated or not applicable to your case. If the issue persists, we highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still need assistance, please open a new support ticket.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by Trevor 2 years, 9 months ago.

Assisted by: Bobby.

Author Posts
February 22, 2022 at 4:30 pm #10638305

Trevor

Our client is trying to: save a translation.

Link to a page where the issue can be seen: (not public)

Our client expected to see: "Post saved."

Instead, our client got:

"What I;m finding here is that if I click save draft, preview or publish I get the error, but the page actually publishes"

2022/02/22 09:38:27 [error] 4271#4271: *1711741 FastCGI sent in stderr: "PHP message: WordPress database error Duplicate entry '0' for key 'PRIMARY' for query INSERT INTO `wp_icl_translation_status` (`translation_id`, `status`, `translator_id`, `needs_update`, `md5`, `translation_service`, `translation_package`) VALUES ('4073', '10', '23', '', '2ed5262030411fd3bf37915aa5611f73', 'local', 'a:4:{s:3:\"url\";s:30:\"<em><u>hidden link</u></em>\";s:5:\"title\";s:13:\"MAS licencing\";s:8:\"contents\";a:15:{s:29:\"field-_yoast_wpseo_metadesc-0\";a:3:{s:9:\"translate\";i:1;s:4:\"data\";s:176:\"R2V0dGluZyBsaWNlbnNlZCBmb3IgdGhlIGZpcnN0IHRpbWUsIGNoYW5naW5nIHlvdXIgbGljZW5zZSwgb3Igc2Vla2luZyBwZXJtaXNzaW9uIGZvciBhIG5ldyBjb250cm9sbGluZyBzaGFyZWhvbGRlcj8gV2UgY2FuIGhlbHAuwqA=\";s:6:\"format\";s:6:\"base64\";}s:34:\"field-_yoast_wpseo_metadesc-0-name\";a:2:{s:9:\"translate\";i:0;s:4:\"data\";s:23:\"_yoast_wpseo_metadesc-0\";}s:34:\"field-_yoast_wpseo_metadesc-0-type\";a:2:{s:9:\"translate\";i:0;s:4:\"data\";s:12:\"custom_field\";}s:28:\"field-_yoast_wpseo_focuskw-0\";a:3:{s:9:\"trans...PHP message: WordPress database error Duplicate entry '0' for key 'PRIMARY' for query INSERT INTO `wp_icl_translation_batches` (`batch_name`, `last_update`) VALUES ('Manual Translations from February the 22nd, 2022', '2022-02-22 09:38:27') made by edit_post, wp_update_post, wp_insert_post, do_action('save_post'), WP_Hook->do_action, WP_Hook->apply_filters, WPML_Admin_Post_Actions->save_post_actions, WPML_Post_Translation->after_save_post, do_action('wpml_tm_save_post'), WP_Hook->do_action, WP_Hook->apply_filters, wpml_tm_save_post, WPML_TM_Post_Actions->save_post_actions, TranslationManagement->update_translation_status, do_action('wpml_updated_translation_status'), WP_Hook->do_action, WP_Hook->apply_filters, TranslationProxy_Batch::maybe_assign_generic_batch, TranslationProxy_Batch::create_generic_batch, TranslationProxy_Batch::update_translation_batch, WPML\LIB\WP\Cache::WPML\LIB\WP\{closure}, call_user_func_array, TranslationProxy_Batch::{clo
February 23, 2022 at 12:29 am #10640339

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Hi there,

The error

WordPress database error Duplicate entry '0' for key 'PRIMARY' for query INSERT INTO `wp_icl_translation_status` (`translation_id`, `status`, `translator_id`, `needs_update`, `md5`, `translation_service`, `translation_package`) VALUES ('4073', '10', '23', '',

Is pointing to a duplicate entry of '0' in the database.

This means most likely that AUTO INCREMENT is deactivated.

1. Go to icl_translation_status table in your database and review the structure.

2. Do you see AUTO INCREMENT enabled?

Additionally, I recommend reviewing standard WP tables such as wp_options , wp_posts, wp_users, etc. as well to verify that AUTO INCREMENT is enabled. (not all tables need it enabled)

https://wordpress.stackexchange.com/questions/225641/wordpress-database-lost-auto-increment

Important Note: If an entry with 0 exists in a database table that you are trying to enable AUTO INCREMENT, you wont be able to enable it until the 0 entry is removed.

NOTE: Always have a recent and working backup before making any changes recommended by our team or a 3rd party

The reason this would happen would be database corruption. Migrations are sometimes a known cause of this.