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

[5.x]: Error: A field layout element has a duplicate UUID when upgrading from craft 4 to craft 5 #16032

Closed
LukeAndrewColeman opened this issue Nov 6, 2024 · 16 comments
Assignees
Labels

Comments

@LukeAndrewColeman
Copy link

LukeAndrewColeman commented Nov 6, 2024

What happened?

Description

I have just been trying to upgrade from craft 4 to craft 5, I managed to do this locally without any problems, when i went to push the changes to staging i got this error Error: A field layout element has a duplicate UUID. Reinstall Craft CMS ^4.4.14 and run utils/fix-field-layout-uids before upgrading to Craft CMS 5, this caused the migrations to fail.

I did notice that this got fixed recently in 5.0.3 but i'm still having the issue, i also tried going back to craft 4 and running the suggested command which resulted in no duplicates.

All environments are on the latest craft 4 versions including the plugins.

Expected behavior

Migrations to run and upgrade to craft 5.

Actual behavior

Migrations failed.

Craft CMS version

Staging (4.12.8) Local (5.4.9)

PHP version

Staging (8.2.21) Local (8.2.15)

Operating system and version

Mac OS 15.0.1

Database type and version

Staging (MySQL 28.1) Local (MySQL 8.0.33)

Image driver and version

Staging (Imagick 3.7.0 (ImageMagick 7.1.1-32)) Local (Imagick 3.7.0 (ImageMagick 6.9.11-60))

Installed plugins and versions

Staging
Calendar | 5.0.10
CKEditor | 3.10.0
Element API | 4.1.0
Feed Me | 5.8.2
Formie | 2.1.32
Image Resizer | 3.0.12
Minify | 4.0.1
Navigation | 2.1.1
Neo | 4.2.18
Redactor | 3.1.0
Retour | 4.1.19
Scout | 4.1.1
SEOmatic | 4.1.5
Servd Assets and Helpers | 3.5.19
Table Maker | 4.0.14
Vite | 4.0.10
Wordsmith | 4.5.0

Local
Calendar | 5.0.11
CKEditor | 4.3.1
Element API | 4.1.0
Feed Me | 6.5.0
Formie | 3.0.9
Image Resizer | 4.0.1
Minify | 5.0.0
Navigation | 3.0.5
Neo | 5.2.14
Redactor | 4.2.0
Retour | 5.0.3
Scout | 5.0.1
SEOmatic | 5.1.5
Servd Assets and Helpers | 4.0.8
Table Maker | 5.0.3
Vite | 5.0.1
Wordsmith | 5.0.0

@brandonkelly
Copy link
Member

brandonkelly commented Nov 7, 2024

Would you be able to share your Craft 4 database backup and Composer files with us? Then we could look into it and see where the duplicate is, and why the CLI command isn’t fixing it.

If so, please send them to [email protected].

@LukeAndrewColeman
Copy link
Author

Hi Brandon, great i have shard requested files via Google Drive.

@brandonkelly
Copy link
Member

Thanks for the files! This is fixed now for the next Craft 5 release.

If you’d like to get those changes ahead of time, change your craftcms/cms requirement in composer.json to:

"craftcms/cms": "5.x-dev as 5.4.10.1",

Then run composer update.

@LukeAndrewColeman
Copy link
Author

Great thank you. I will give this ago today.

@LukeAndrewColeman
Copy link
Author

Hey, i gave that a try and i'm still getting the same error.

@brandonkelly
Copy link
Member

Sorry, I forgot to apply part of the fix. Can you try running composer update again?

Make sure to restore a Craft 4 database backup first, as well.

@LukeAndrewColeman
Copy link
Author

Hey, i didn't update by changing the package version for craft, because the update was already live, so i just updated via the cms. Do you think it would be better doing it manually by updating the package in composer.json?

@brandonkelly
Copy link
Member

brandonkelly commented Nov 11, 2024

The fix hasn’t been tagged yet, so you need to make that composer.json change I mentioned before running composer update, which tells Composer to pull the latest from the 5.x branch.

so i just updated via the cms.

Like, within the control panel? How would you be doing that if you aren’t able to upgrade to Craft 5 in the first place due to this error?

@LukeAndrewColeman
Copy link
Author

LukeAndrewColeman commented Nov 11, 2024

OK i'll try it manually.

Yeah i have updated to craft 5 locally and everything works fine (this is where i saw the update for craft 5 in the cms), its when i then push this to staging (which is currently on craft 4) it fails with the migration error.

The merged fields migrations all seem to work fine, its just when it get to that certain migration.

*** applying m230511_215903_content_refactor
Exception: An event field layout element has a duplicate UUID. Reinstall Craft CMS ^4.4.14 and run utils/fix-field-layout-uids before upgrading to Craft CMS 5. (/var/www/html/vendor/craftcms/cms/src/migrations/m230511_215903_content_refactor.php:34)

@LukeAndrewColeman
Copy link
Author

I have done what you said and that seems to have worked, thank you for fixing, much appreciated.

@brandonkelly
Copy link
Member

Sweet!

@brandonkelly
Copy link
Member

Craft 5.5.0 is out with that fix. Thanks again!

@viesrood
Copy link

I just tried upgrading tot version 5 from 4.13.0 , but I'm still getting the same error. Craft 5.5 has already been released.

Exception: A field layout element is missing its UUID. Reinstall Craft CMS ^4.4.14 and run utils/fix-field-layout-uids before upgrading to Craft CMS 5.

@brandonkelly
Copy link
Member

@viesrood To be clear, the 5.5 change doesn’t negate the need to run the utils/fix-field-layout-uids command before upgrading. Did you do that?

@strandofgenius
Copy link

strandofgenius commented Dec 13, 2024

@brandonkelly I did run this command before my upgrade process and I still get this error. I am upgrading from Craft CMS 4.13.6 -> Craft CMS 5.5.6.1

@strandofgenius
Copy link

We did chat in discord and set over my files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants