Problem/Motivation
The views_custom_cache_tag module's getCacheTags() method unconditionally calls $view->getStyle() to resolve tokens in custom cache tag strings. However, this causes
unnecessary instantiation of the style plugin (and via Views internals, the row plugin) even when the configured custom tag string contains no tokens that need resolving.
When the plugin definition cache is in a transient bad state immediately after a Pantheon cache rebuild/clear, this unconditional instantiation can trigger a PluginNotFoundException in
EntityRow::init(), with an empty entity type string.
Real-world impact: On a Drupal 11 / Pantheon production site, this issue caused ~89% (3,509 out of 3,984) of watchdog errors within an 18-minute window following a Pantheon deploy cache
flush. Every page view that executed a View with a custom cache tag resulted in this exception, making the site effectively broken until the cache recovered.
Steps to reproduce
- Configure a View with the
views_custom_cache_tagmodule enabled. - Set a static (non-token) custom cache tag string in the View display settings (e.g.,
my_custom_tag). - Perform a full cache clear on Pantheon (or equivalent cache rebuild), ensuring the plugin definition cache is temporarily in a bad state.
- Load any page that executes the View.
- Observe the
PluginNotFoundException: The "" entity type does not existerror inEntityRow::init().
Note: This is most easily reproduced on a Pantheon environment immediately after a deploy cache flush, when plugin caches are temporarily out of sync. On local DDEV, the recovery is often
too fast to catch easily.
Proposed resolution
In the getCacheTags() method, check whether the configured custom tag string contains any tokens (e.g., [view:*] patterns) that require resolving before calling
$view->getStyle(). If the tag string is a plain static string with no tokens, skip the getStyle() call entirely and return the tag directly.
This avoids the unnecessary plugin instantiation for the common case where the custom tag is a static string, while preserving the current behavior for dynamic token-based tags.
Remaining tasks
- [ ] Confirm reproduction and root cause
- [ ] Write the fix to skip
getStyle()for static (non-token) custom tags - [ ] Add test coverage for both static and token-based tags
- [ ] Review and merge
User interface changes
None
API changes
None
Data model changes
None
Note: A merge request with the proposed fix will follow.
Issue fork views_custom_cache_tag-3590375
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
shiraz dindar