- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2021
07:23 PM
11-10-2021
07:23 PM
Magento 2 An element with a "root" ID already exists
After install third-party extension. An output error similar to this:
vendor/magento/framework/Data/Form.php: 'An element with a "' . $elementId . '" ID already exists.'
Labels:
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2021
01:42 AM
11-11-2021
01:42 AM
Re: Magento 2 An element with a "root" ID already exists
To fix the ""An element with a “root” ID already exists"" error:
1. Find a PHP file and a line that throws an exception.
2. Open CLI (terminal), navigate to the Magento root directory, and run the following commands to find the proper file:
grep vendor/ -re ' ID already exists' grep app/ -re ' ID already exists'
As a result, you will get an output similar to this:
vendor/magento/framework/Data/Form.php: 'An element with a ""' . $elementId . '"" ID already exists.' vendor/magento/framework/Data/Test/Unit/FormTest.php: $this->expectExceptionMessage('An element with a ""1"" ID already exists.'); vendor/magento/framework/Data/Structure.php: new \Magento\Framework\Phrase('An element with a ""%1"" ID already exists.', [$elementId])
Then open each file and edit ID
If issue solved, Click Kudos & Accept as Solution.
LitCommerce - The Most Simple & Affordable Multi-channel Selling Tool
LitCommerce - The Most Simple & Affordable Multi-channel Selling Tool