laravel/framework · error · BadMethodCallException

This cache store does not support tagging.

Error message

This cache store does not support tagging.

What it means

Thrown by Cache\Repository::tags() when supportsTags() is false, i.e. the store has no tags() method (method_exists check). Tagged caching is only available on stores that implement tag sets, such as redis, memcached, array, and database (with the tag table). File and DynamoDB stores do not.

Source

Thrown at src/Illuminate/Cache/Repository.php:850

        } else {
            $this->event(new CacheLocksFlushFailed($this->getName()));
        }

        return $result;
    }

    /**
     * Begin executing a new tags operation if the store supports it.
     *
     * @param  mixed  $names
     * @return \Illuminate\Cache\TaggedCache
     *
     * @throws \BadMethodCallException
     */
    public function tags($names)
    {
        if (! $this->supportsTags()) {
            throw new BadMethodCallException('This cache store does not support tagging.');
        }

        $cache = $this->store->tags(is_array($names) ? $names : func_get_args());

        $cache->config = $this->config;

        if (! is_null($this->events)) {
            $cache->setEventDispatcher($this->events);
        }

        return $cache->setDefaultCacheTime($this->default);
    }

    /**
     * Format the key for a cache item.
     *
     * @param  string  $key
     * @return string

View on GitHub (pinned to bd6b5437e6)

Solutions

  1. Switch CACHE_STORE to redis, memcached, database, or array (array supports tags).
  2. Guard the call: if (Cache::supportsTags()) { Cache::tags(['users'])->flush(); }.
  3. Refactor to manual key-prefix invalidation if you must keep a non-tagging store.
  4. If using the database store, ensure migrations for the cache and cache_tags tables are present.

Example fix

// before
Cache::tags(['posts'])->flush();

// after
if (Cache::supportsTags()) {
    Cache::tags(['posts'])->flush();
}
// or .env: CACHE_STORE=redis
Defensive patterns

Strategy: validation

Validate before calling

if (! Cache::supportsTags()) {
    // use a non-tagged key scheme or switch store
}

Type guard

function cacheSupportsTags(): bool {
    return Cache::supportsTags();
}

Try / catch

try {
    Cache::tags(['users'])->flush();
} catch (\BadMethodCallException $e) {
    // store can't tag; flush by key prefix instead
}

Prevention

When it happens

Trigger: Calling Cache::tags(['users'])->put(...) or Cache::tags(['users'])->flush() while CACHE_STORE is file, dynamodb, or another store without a tags() method.

Common situations: Local dev using CACHE_STORE=file hitting code that tags cached query results; running the app with a custom Store that did not implement tags(); CI using array driver but the test calls tags() on a cache facade backed by something else.

Related errors


AI-assisted analysis of laravel/framework@bd6b5437e6 (2026-08-06). Data as JSON: /data/errors/34a3d607175be015.json. Report an issue: GitHub.