composer install or update error, what is wrong

I have a problem. After command

composer update

I get error message

 [Symfony\Component\Console\Exception\LogicException]
  An option named "connection" already exists.


Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception


  [RuntimeException]
  An error occurred when executing the ""cache:clear --no-warmup"" command:





    [Symfony\Component\Console\Exception\LogicException]
    An option named "connection" already exists.

what am I doing wrong?

Exception trace:
 () at C:\wamp64\www\ecommerce\vendor\symfony\symfony\src\Symfony\Component\Console\Input\InputDefinition.php:232
 Symfony\Component\Console\Input\InputDefinition->addOption() at C:\wamp64\www\ecommerce\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php:384
 Symfony\Component\Console\Command\Command->addOption() at C:\wamp64\www\ecommerce\vendor\doctrine\doctrine-bundle\Command\Proxy\RunSqlDoctrineCommand.php:24
 Doctrine\Bundle\DoctrineBundle\Command\Proxy\RunSqlDoctrineCommand->configure() at C:\wamp64\www\ecommerce\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php:61
 Symfony\Component\Console\Command\Command->__construct() at C:\wamp64\www\ecommerce\vendor\doctrine\dbal\lib\Doctrine\DBAL\Tools\Console\Command\RunSqlCommand.php:36
 Doctrine\DBAL\Tools\Console\Command\RunSqlCommand->__construct() at C:\wamp64\www\ecommerce\var\cache\dev\appDevDebugProjectContainer.php:11355
 appDevDebugProjectContainer->getDoctrine_QuerySqlCommandService() at C:\wamp64\www\ecommerce\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\Container.php:329
 Symfony\Component\DependencyInjection\Container->get() at C:\wamp64\www\ecommerce\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:140
 Symfony\Bundle\FrameworkBundle\Console\Application->registerCommands() at C:\wamp64\www\ecommerce\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:100
 Symfony\Bundle\FrameworkBundle\Console\Application->all() at C:\wamp64\www\ecommerce\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:64
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at C:\wamp64\www\ecommerce\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:122
 Symfony\Component\Console\Application->run() at C:\wamp64\www\ecommerce\bin\console:27

I get all project with git, and on one computer all running, on second not running.


Run the command with the -vvv flag. It will show you which command is broken. For example:

bin/console -vvv

I have the same error after upgrade doctrine/dbal package. In my case RunSqlDoctrineCommand (from doctrine/doctrine-bundle package) conflicted with parent RunSqlCommand (from doctrine/dbal package). I've updated doctrine/doctrine-bundle:1.12.*, it contains fix for this case. This solved such problem.


In my case, a certain project with symfony v3.3 failed doing composer install under PHP 7.4 and also PHP 7.2 saying An option named "connection" already exists..

Tested solutions:

  • Downgrading to PHP 7.0, it worked perfectly with SF v3.3
  • Upgrading symfony to v3.4, it worked perfectly with PHP 7.2 and 7.4.

Haven't dived too deep, but looks like doctrine/doctrine-bundle should have one of this versions: 2.4.3 2.4.2 2.4.1 2.4.0 2.3.2 2.3.1 2.3.0 2.2.4 2.2.3 2.2.2 2.2.1 2.2.0 2.1.2 2.1.1 2.1.0 2.0.10 2.0.9 1.12.13 1.12.12 1.12.11 1.12.10 1.12.9

So, update it to one of them.

For example, for 1.12 you can specify it like this at composer.json:

        "doctrine/doctrine-bundle": "^1.12.9",

And then composer update or composer update doctrine/doctrine-bundle

More details:

  • https://github.com/doctrine/DoctrineBundle/pull/1170
  • https://github.com/doctrine/DoctrineBundle/commit/86d2469d6be06d55ad7b9e2f076f6942476f2e87

On PHP 7.1, I had to:

  1. Update symfony/symfony from 3.3.* to 3.4.*
  2. Update doctrine/doctrine-bundle from ^1.6 to ^1.12