{"record":{"id":"34a3d607175be015","repo":"laravel/framework","slug":"this-cache-store-does-not-support-tagging","errorCode":null,"errorMessage":"This cache store does not support tagging.","messagePattern":"This cache store does not support tagging\\.","errorType":"exception","errorClass":"BadMethodCallException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Cache/Repository.php","lineNumber":850,"sourceCode":"        } else {\n            $this->event(new CacheLocksFlushFailed($this->getName()));\n        }\n\n        return $result;\n    }\n\n    /**\n     * Begin executing a new tags operation if the store supports it.\n     *\n     * @param  mixed  $names\n     * @return \\Illuminate\\Cache\\TaggedCache\n     *\n     * @throws \\BadMethodCallException\n     */\n    public function tags($names)\n    {\n        if (! $this->supportsTags()) {\n            throw new BadMethodCallException('This cache store does not support tagging.');\n        }\n\n        $cache = $this->store->tags(is_array($names) ? $names : func_get_args());\n\n        $cache->config = $this->config;\n\n        if (! is_null($this->events)) {\n            $cache->setEventDispatcher($this->events);\n        }\n\n        return $cache->setDefaultCacheTime($this->default);\n    }\n\n    /**\n     * Format the key for a cache item.\n     *\n     * @param  string  $key\n     * @return string","sourceCodeStart":832,"sourceCodeEnd":868,"githubUrl":"https://github.com/laravel/framework/blob/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Cache/Repository.php#L832-L868","documentation":"Thrown by Repository::tags() when supportsTags() is false, i.e. the store does not implement Illuminate\\Contracts\\Cache\\Store with tag support. Tagged caching requires the store to namespace and invalidate by tag, which array, file, dynamodb, and some custom stores cannot do.","triggerScenarios":"Calling Cache::tags(['a','b'])->put(...) while CACHE_STORE is array, file, or another non-tagging driver.","commonSituations":"Test suites using CACHE_STORE=array hitting production code that uses tagged cache; deploying to a host without redis/memcached/database; misconfigured CACHE_DRIVER.","solutions":["Switch to a tag-capable store: redis, memcached, or database.","Guard the call: if ($cache->supportsTags()) { ... } before using tags.","In tests, use the database store (sqlite) which supports tags."],"exampleFix":"// before\nCACHE_STORE=array\n// after (config/cache.php or env)\nCACHE_STORE=database","handlingStrategy":"type-guard","validationCode":"if (Cache::supportsTags()) {\n    Cache::tags(['users'])->put('user:1', $user, now()->addHour());\n} else {\n    Cache::put('user:1', $user, now()->addHour());\n}","typeGuard":"// Repository exposes supportsTags(); use it.\nfunction storeSupportsTags(\\Illuminate\\Cache\\Repository $cache): bool {\n    return $cache->supportsTags();\n}","tryCatchPattern":"try {\n    Cache::tags(['users'])->flush();\n} catch (\\BadMethodCallException $e) {\n    // no tag support; fall back to plain key invalidation\n    Cache::forget('user:1');\n}","preventionTips":["Choose redis/memcached/database when you need tagged cache.","Guard tags() with supportsTags() for portable code.","Use a tag-capable store in tests if production uses tags."],"tags":["cache","tags","configuration","laravel"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}