diff -u b/core/lib/Drupal/Core/Render/RenderCache.php b/core/lib/Drupal/Core/Render/RenderCache.php --- b/core/lib/Drupal/Core/Render/RenderCache.php +++ b/core/lib/Drupal/Core/Render/RenderCache.php @@ -221,7 +221,7 @@ // The set of cache contexts for this element, including the bubbled ones, // for which we are handling a cache miss. - $cache_contexts = Cache::mergeContexts($elements['#cache']['contexts'], $required_cache_contexts); + $cache_contexts = Cache::mergeContexts($data['#cache']['contexts'], $required_cache_contexts); // Get the contexts by which this element should be varied according to // the current redirecting cache item, if any.