{"record":{"id":"e01970c9da207cf3","repo":"symfony/symfony","slug":"messenger-support-cannot-be-enabled-as-the-messeng","errorCode":null,"errorMessage":"Messenger support cannot be enabled as the Messenger component is not installed. Try running \"composer require symfony/messenger\".","messagePattern":"Messenger support cannot be enabled as the Messenger component is not installed\\. Try running \"composer require symfony/messenger\"\\.","errorType":"validation","errorClass":"LogicException","httpStatus":null,"severity":"error","filePath":"src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php","lineNumber":2389,"sourceCode":"    }\n\n    private function registerSchedulerConfiguration(ContainerBuilder $container, PhpFileLoader $loader): void\n    {\n        if (!class_exists(SchedulerTransportFactory::class)) {\n            throw new LogicException('Scheduler support cannot be enabled as the Scheduler component is not installed. Try running \"composer require symfony/scheduler\".');\n        }\n\n        $loader->load('scheduler.php');\n\n        if (!$this->hasConsole()) {\n            $container->removeDefinition('console.command.scheduler_debug');\n        }\n    }\n\n    private function registerMessengerConfiguration(array $config, ContainerBuilder $container, PhpFileLoader $loader, bool $validationEnabled, bool $lockEnabled): void\n    {\n        if (!interface_exists(MessageBusInterface::class)) {\n            throw new LogicException('Messenger support cannot be enabled as the Messenger component is not installed. Try running \"composer require symfony/messenger\".');\n        }\n\n        if (!$this->hasConsole()) {\n            $container->removeDefinition('console.command.messenger_stats');\n        }\n\n        $loader->load('messenger.php');\n\n        if (!interface_exists(DenormalizerInterface::class)) {\n            $container->removeDefinition('serializer.normalizer.flatten_exception');\n        }\n\n        if (ContainerBuilder::willBeAvailable('symfony/amqp-messenger', MessengerBridge\\Amqp\\Transport\\AmqpTransportFactory::class, ['symfony/framework-bundle', 'symfony/messenger'])) {\n            $container->getDefinition('messenger.transport.amqp.factory')->addTag('messenger.transport_factory');\n        }\n\n        if (ContainerBuilder::willBeAvailable('symfony/redis-messenger', MessengerBridge\\Redis\\Transport\\RedisTransportFactory::class, ['symfony/framework-bundle', 'symfony/messenger'])) {\n            $container->getDefinition('messenger.transport.redis.factory')->addTag('messenger.transport_factory');","sourceCodeStart":2371,"sourceCodeEnd":2407,"githubUrl":"https://github.com/symfony/symfony/blob/698e28026c22cf35d032cdb6e800db48b1535790/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php#L2371-L2407","documentation":"Thrown by registerMessengerConfiguration() when Messenger is configured but the MessageBusInterface (from symfony/messenger) is not autoloadable. The extension guards every component integration with an interface/class existence check so that a missing package yields a clear, actionable message instead of a confusing class-not-found during service wiring. It is a compile-time LogicException.","triggerScenarios":"Having a `framework.messenger` config block (transports, buses, routing) without symfony/messenger installed. Triggered during container compilation — `cache:clear`, `warmup`, or any cold boot.","commonSituations":"Recipe installed the Messenger config but the package was removed or never required; a flex update pulled in the messenger recipe; copy-pasted messenger.yaml from another project; splitting monolith deps without pruning config.","solutions":["Run `composer require symfony/messenger`, then `php bin/console cache:clear`.","If Messenger is not wanted, delete the `framework.messenger` section from config/packages/*.yaml and clear the cache.","Confirm the interface is present: `php -r 'echo interface_exists(\"Symfony\\\\Component\\\\Messenger\\\\MessageBusInterface\") ? \"yes\":\"no\";'`."],"exampleFix":"# before\nframework:\n    messenger:\n        transports:\n            async: '%env(MESSENGER_TRANSPORT_DSN)%'\n# (symfony/messenger missing -> LogicException)\n\n# after\n# terminal: composer require symfony/messenger","handlingStrategy":"validation","validationCode":"// Mirror the extension's own guard before enabling messenger config.\n$isMessengerAvailable = interface_exists(\\Symfony\\Component\\Messenger\\MessageBusInterface::class);\nif (!$isMessengerAvailable) {\n    throw new \\LogicException('Enable symfony/messenger before adding framework.messenger config.');\n}","typeGuard":"null","tryCatchPattern":"null","preventionTips":["In CI run `cache:clear` (or `lint:container`) on a cold cache so missing-component LogicExceptions surface.","When you remove symfony/messenger, also delete config/packages/messenger.yaml in the same change.","Use composer 2 runtime autoload checks (`composer dump-autoload --strict`) to detect dropped classes."],"tags":["symfony","messenger","dependency-injection","configuration","composer"],"analyzedSha":"698e28026c22cf35d032cdb6e800db48b1535790","analyzedAt":"2026-08-06T23:40:49.025Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}