-
Notifications
You must be signed in to change notification settings - Fork 670
[4.x]: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '271300-1' for key 'revisions.revisions_sourceId_num_unq_idx' #16628
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
Comments
Hi, please search for that error in your logs and post the stack trace that follows it. |
I just ran into the same problem on a Craft 5 site (upgraded from Craft 4) and happens every time a particular entry is saved. The site is large so the issue may affect other entries as well. Originally a Craft 4 site, upgraded to latest Craft 5. It has 2 languages and revisions enabled. Craft CMS version PHP version Operating system and version Database type and version Installed plugins and versions Logs
|
@brandonkelly Yes, looks like I did not attached the screenshot of the stack trace :-) As mentioned I disabled all plugins and saw that the stack trace only uses files in vendor/craft/cms and vendor/yiisoft. I googled the problem and saw that other developers were getting the same error message. But this had to do with the plugin Craft neo. I dont use Craft Neo. |
@cg-sthomas Since it’s reproducible in your case, can you send a database backup and your Composer files over to [email protected] so we can take a look on our end? |
Running into the same issue:
Craft 4.13.10 |
|
Actually turned out this isn't working either, so to summarise:
The same error happens if you don't roll the entry type merge into the same branch / release, eg.
|
My issue appeared on saving an entry, nothing fancy but the entry is now completly bricked. |
Updated to Craft 4.14.4, entry still impossible to save, any tips on how to get past this? |
@jan-dh If you send your database and Composer files into [email protected], and point out which entry is having issues, we can look into it from there. |
It looks like the common culprit with these issues is revision data for elements that no longer exist. That can happen if elements are deleted while the database is missing its foreign keys, or foreign keys are temporarily disabled. As of Craft 4.14.0 and 5.6.0, the If that doesn’t help, your database may be missing its foreign keys, which you can restore using the Fix FKs plugin. |
@brandonkelly I'm still getting this issue on Craft v5.6.17 after running craft entry-types/merge, I've tried running craft gc and the Fix FKs plugin Steps to reproduce:
Gives
I've emailed a DB dump and composer files to [email protected] if you're able to advise, thanks in advance 😊 |
Thanks @MangoMarcus! Fixed for the next release. The error occurred because the outgoing entry type was used by a Single section, which apparently hasn’t been done before! |
Craft 5.7.5 is out with that fix. Thanks again! |
Thanks as ever @brandonkelly ! |
What happened?
Description
Some entries trigger en error when saving.
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '271300-1' for key 'revisions.revisions_sourceId_num_unq_idx'
The SQL being executed was: INSERT INTO
revisions
(canonicalId
,creatorId
,num
,notes
) VALUES (271300, 1, 1, NULL)Error Info: Array
(
[0] => 23000
[1] => 1062
[2] => Duplicate entry '271300-1' for key 'revisions.revisions_sourceId_num_unq_idx'
)
Steps to reproduce
I dont know how to reproduce the error. The error occurs irregularly.
I tried to reduce the count of revisions to 1 but it does not fix the problem. My temporary solution is to empty the revisions table.
I also disabled all plugins to make sure that the error error is not triggered by one of the plugins.
Expected behavior
Saving the entry.
Actual behavior
Craft CMS version
4.13.7
PHP version
8.2
Operating system and version
Ubuntu & Mac
Database type and version
MySQL 9.0.1 & MariaDB 10.6.20
Image driver and version
No response
Installed plugins and versions
craftcms/cms: "^4",
craftcms/redactor: "3.0.4",
dodecastudio/craft-blurhash: "2.0.3",
dolphiq/redirect: "^2.0.1",
guzzlehttp/guzzle: "^7.0",
lewisjenkins/craft-dynamic-fields: "^4",
nesbot/carbon": "^3",
phpoffice/phpspreadsheet: "^2",
phpoffice/phpword: "^1",
tecnickcom/tcpdf: "^6.7",
vaersaagod/matrixmate: "^2",
verbb/cp-nav: "^4",
verbb/formie: "^2",
verbb/super-table: "^3",
vlucas/phpdotenv: "^5.6"
The text was updated successfully, but these errors were encountered: