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 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.

Solutions

  1. Switch to a tag-capable store: redis, memcached, or database.
  2. Guard the call: if ($cache->supportsTags()) { ... } before using tags.
  3. In tests, use the database store (sqlite) which supports tags.

Example fix

// before
CACHE_STORE=array
// after (config/cache.php or env)
CACHE_STORE=database
Defensive patterns

Strategy: type-guard

Validate before calling

if (Cache::supportsTags()) {
    Cache::tags(['users'])->put('user:1', $user, now()->addHour());
} else {
    Cache::put('user:1', $user, now()->addHour());
}

Type guard

// Repository exposes supportsTags(); use it.
function storeSupportsTags(\Illuminate\Cache\Repository $cache): bool {
    return $cache->supportsTags();
}

Try / catch

try {
    Cache::tags(['users'])->flush();
} catch (\BadMethodCallException $e) {
    // no tag support; fall back to plain key invalidation
    Cache::forget('user:1');
}

Prevention

When it happens

Trigger: Calling Cache::tags(['a','b'])->put(...) while CACHE_STORE is array, file, or another non-tagging driver.

Common situations: Test suites using CACHE_STORE=array hitting production code that uses tagged cache; deploying to a host without redis/memcached/database; misconfigured CACHE_DRIVER.

Related errors


AI-assisted analysis of laravel/framework@e0f6eb3518 (2026-08-11). Data as JSON: /api/errors/34a3d607175be015. Report an issue: GitHub.

Appendix: 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 e0f6eb3518)