{"record":{"id":"7139b5301ddab5ae","repo":"doctrine/orm","slug":"no-result-cache-driver-is-configured-on-given-enti","errorCode":null,"errorMessage":"No Result cache driver is configured on given EntityManager.","messagePattern":"No Result cache driver is configured on given EntityManager\\.","errorType":"console","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/Tools/Console/Command/ClearCache/ResultCommand.php","lineNumber":54,"sourceCode":"\nAlternatively, if you want to flush the cache provider using this command:\n\n<info>%command.name% --flush</info>\n\nFinally, be aware that if <info>--flush</info> option is passed, not all cache providers are able to flush entries,\nbecause of a limitation of its execution nature.\nEOT);\n    }\n\n    protected function execute(InputInterface $input, OutputInterface $output): int\n    {\n        $ui = (new SymfonyStyle($input, $output))->getErrorStyle();\n\n        $em    = $this->getEntityManager($input);\n        $cache = $em->getConfiguration()->getResultCache();\n\n        if (! $cache) {\n            throw new InvalidArgumentException('No Result cache driver is configured on given EntityManager.');\n        }\n\n        $ui->comment('Clearing <info>all</info> Result cache entries');\n\n        $message = $cache->clear() ? 'Successfully deleted cache entries.' : 'No cache entries were deleted.';\n\n        $ui->success($message);\n\n        return 0;\n    }\n}\n","sourceCodeStart":36,"sourceCodeEnd":66,"githubUrl":"https://github.com/doctrine/orm/blob/d9b9ff73016bf598ae07515f97289ce8074e97a5/src/Tools/Console/Command/ClearCache/ResultCommand.php#L36-L66","documentation":"orm:clear-cache:result clears the result cache via $em->getConfiguration()->getResultCache(). With no result cache configured the getter returns null (this ORM sets no default), and the command throws InvalidArgumentException rather than reporting success on a cache that does not exist.","triggerScenarios":"Running orm:clear-cache:result on an EntityManager whose configuration never called setResultCache() (doctrine-bundle: result_cache_driver); apps that enable result caching per query without a global result cache; CLI kernels booting a minimal configuration.","commonSituations":"ORM 3 migrations where the implicit default result cache disappeared; deploy scripts clearing every cache command unconditionally; dev environments with caching disabled.","solutions":["Configure a result cache where you intend to clear it: $config->setResultCache($adapter) or doctrine-bundle orm result_cache_driver.","If you never use result caching, remove the command from your routine.","Verify in the CLI context: $em->getConfiguration()->getResultCache() !== null."],"exampleFix":"// before\n$ php bin/console doctrine:orm:clear-cache:result\n// InvalidArgumentException: No Result cache driver is configured...\n\n// after\n$config->setResultCache(new Symfony\\Component\\Cache\\Adapter\\PhpFilesAdapter(\n    'orm_result', 0, $cacheDir\n));","handlingStrategy":"validation","validationCode":"if ($em->getConfiguration()->getResultCache() === null) {\n    // no result cache configured: nothing to clear, skip the command\n    return 0;\n}\n// run orm:clear-cache:result","typeGuard":null,"tryCatchPattern":"Catch \\InvalidArgumentException around the command in deploy scripts and log 'result cache not configured' as info instead of failing the pipeline.","preventionTips":["Configure an explicit result cache in every environment that runs cache commands.","If you only use per-query enableResultCache(), remember the global pool is still what gets cleared.","Smoke-test deploy scripts against a production-like configuration."],"tags":["doctrine-orm","console","cache","result-cache","cli","symfony"],"backgroundTag":"missing-cache-configuration","analyzedSha":"d9b9ff73016bf598ae07515f97289ce8074e97a5","analyzedAt":"2026-08-21T06:13:15.863Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}