{"record":{"id":"8ae448612ba102e5","repo":"symfony/http-kernel","slug":"cache-pool-not-found-s","errorCode":null,"errorMessage":"Cache pool not found: \"%s\".","messagePattern":"Cache pool not found: \"(.+?)\"\\.","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"CacheClearer/Psr6CacheClearer.php","lineNumber":42,"sourceCode":"     * @param array<string, CacheItemPoolInterface> $pools\n     */\n    public function __construct(array $pools = [])\n    {\n        $this->pools = $pools;\n    }\n\n    public function hasPool(string $name): bool\n    {\n        return isset($this->pools[$name]);\n    }\n\n    /**\n     * @throws \\InvalidArgumentException If the cache pool with the given name does not exist\n     */\n    public function getPool(string $name): CacheItemPoolInterface\n    {\n        if (!$this->hasPool($name)) {\n            throw new \\InvalidArgumentException(\\sprintf('Cache pool not found: \"%s\".', $name));\n        }\n\n        return $this->pools[$name];\n    }\n\n    /**\n     * @throws \\InvalidArgumentException If the cache pool with the given name does not exist\n     */\n    public function clearPool(string $name): bool\n    {\n        if (!isset($this->pools[$name])) {\n            throw new \\InvalidArgumentException(\\sprintf('Cache pool not found: \"%s\".', $name));\n        }\n\n        return $this->pools[$name]->clear();\n    }\n\n    public function clear(string $cacheDir): void","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/symfony/http-kernel/blob/aa3a39d7286a62cdfea98f0e69c651a3da6e36cf/CacheClearer/Psr6CacheClearer.php#L24-L60","documentation":"Psr6CacheClearer::getPool() looks up a registered PSR-6 cache pool service by its name and throws InvalidArgumentException when no pool with that name is registered. It exists so cache:clear and user code fail loudly instead of returning a null pool.","triggerScenarios":"Calling $cacheClearer->getPool('my_pool') when the pool name is not among the pools injected into Psr6CacheClearer (tagged 'cache.pool' services), including misspelled names or pools removed from the container.","commonSituations":"Typo in pool name; pool service missing the cache.pool tag or its 'pool' alias removed; running in an environment where the pool was excluded from the container; code written against a pool that a bundle no longer defines.","solutions":["Check the exact pool name against registered pools: call hasPool($name) or inspect services tagged cache.pool (debug:container --tag=cache.pool).","Fix the typo or use the pool's alias (e.g. 'cache.app') instead of the literal service id.","Ensure the pool service is defined and tagged with kernel.cache_clearer-injected 'cache.pool' in your config for the current environment."],"exampleFix":"// before\n$pool = $clearer->getPool('app_result_cache');\n// after\nif ($clearer->hasPool('app_result_cache')) {\n    $pool = $clearer->getPool('app_result_cache');\n}","handlingStrategy":"type-guard","validationCode":"if (!$cacheClearer->hasPool($name)) { throw new \\DomainException(\"Unknown pool $name\"); }\n$pool = $cacheClearer->getPool($name);","typeGuard":"function getPoolSafe(Psr6CacheClearer $c, string $name): ?CacheItemPoolInterface\n{\n    return $c->hasPool($name) ? $c->getPool($name) : null;\n}","tryCatchPattern":"try { $pool = $clearer->getPool($name); } catch (\\InvalidArgumentException $e) { $pool = null; }","preventionTips":["Use constants/config keys for pool names instead of string literals","Run debug:container --tag=cache.pool to confirm ids","Add an integration test that resolves every pool name used in code"],"tags":["symfony","cache","psr6","not-found"],"backgroundTag":"record-not-found","analyzedSha":"aa3a39d7286a62cdfea98f0e69c651a3da6e36cf","analyzedAt":"2026-09-13T18:03:36.509Z","contentChangedAt":"2026-09-13T18:03:36.509Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}