cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2 An element with a "root" ID already exists

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.'
1 REPLY 1

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