Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WordPress database error Duplicate entry for key 'PRIMARY' for query INSERT INTO wp_term_relationships #7623

Closed
telegraphical opened this issue Jul 2, 2024 · 2 comments
Labels
[Status] Needs Author Reply Requires response from the author [Type] Bug

Comments

@telegraphical
Copy link

Steps to Reproduce

  1. Complete a Course
  2. Sometimes an error occurs as seen below, which stops actions and hooks being fired for the course completion.

What I Expected

For an action to be triggered in a custom plugin that catches when a user has completed a course

What Happened Instead

Rarely, we get the following error in the error logs, but no errors on the frontend. No actions or hooks are fired.

stderr: WordPress database error Duplicate entry '36641-79626' for key 'PRIMARY' for query INSERT INTO wp_term_relationships (object_id, term_taxonomy_id) VALUES (36641, 79626) made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/plugins/sensei-lms/templates/single-course.php'), do_action('sensei_single_course_content_inside_before'), WP_Hook->do_action, WP_Hook->apply_filters, Sensei_Course->the_progress_statement, Sensei_Course->get_progress_statement, Sensei_Course::is_user_enrolled, Sensei_Course_Enrolment->is_enrolled, Sensei_Course_Enrolment->save_enrolment, wp_set_post_terms, wp_set_object_terms

In the last 6 months this has happened around 20 times, but it is being noticed.
This happens on multiple installs, all PHP 8 and all WP versions > 5.2

PHP / WordPress / Sensei LMS version

PHP 8.4
WP 5.5.4
Sensei LMS 4.20.0

@telegraphical telegraphical added [Status] Needs Triage Issue needs to be triaged [Type] Bug labels Jul 2, 2024
@donnapep
Copy link
Collaborator

Hello @telegraphical. We currently only support WordPress 6.3 or higher and the latest version of Sensei. Could you please try upgrading your site to WordPress 6.3+ and Sensei 4.24.1 and see if the issue persists? Thanks.

@donnapep donnapep added [Status] Needs Author Reply Requires response from the author and removed [Status] Needs Triage Issue needs to be triaged labels Jul 11, 2024
@donnapep
Copy link
Collaborator

I'm going to close this issue. Please let us know if it can be reproduced on a newer version of WordPress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Needs Author Reply Requires response from the author [Type] Bug
Projects
None yet
Development

No branches or pull requests

2 participants