Problem/Motivation

After updating from Drupal 10.3 to 10.4 this error emerged:

User warning: Trying to overwrite a cache redirect with one that has nothing in common, old one at address "languages:language_interface, theme, user.permissions" was pointing to "url.path.parent, url.path.is_front, route", new one points to "url.path, languages:language_url". in Drupal\Core\Cache\VariationCache->set() (line 138 of core/lib/Drupal/Core/Cache/VariationCache.php).

Steps to reproduce

No other actions beyond the update.

Proposed resolution

Apparently the cache context in the BreadcrumbBuilder needs to be enhanced. At least this appears to solve the problem in my case.

In BreadcrumbBuilder.php line 227 this row

$breadcrumb->addCacheContexts(['url.path']);

needs to be replaced by this:

$breadcrumb->addCacheContexts([
    'url.path', 
    'languages:language_url', 
    'languages:language_interface', 
    'theme', 
    'user.permissions',
    'url.path.parent',
    'url.path.is_front',
    'route'
]);

Remaining tasks

Review suggestion and update the code.

CommentFileSizeAuthor
#9 3498181-9.patch666 bytesjoe huggans
Command icon 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

marksmith created an issue. See original summary.

mark.labrecque made their first commit to this issue’s fork.

betarobot’s picture

Tested, works fine for me.

laura.j.johnson@gmail.com made their first commit to this issue’s fork.

jonathanlgrrl’s picture

The proposed resolution works, but you can also modify based on menu_breadcrumb's merge request that uses Drupal Core's CacheableMetadata.

jc8654’s picture

Priority: Normal » Major
joe huggans’s picture

Tested this myself, and it does get rid of the error, seems to be working fine now as far as I can tell.

joe huggans’s picture

StatusFileSize
new666 bytes

Provided a patch for easier testing and use until this gets accepted

nrogers’s picture

Status: Active » Reviewed & tested by the community

Works for me as well. Thanks!

subir_ghosh’s picture

I ran into this error as well.

Patch works as of now.

lamp5’s picture

Version: 1.1.2 » 1.x-dev
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.