Last two days suddenly my logs are filled with this in Magento 2.3.2:

report.ERROR: Unable to send the cookie. Size of 'mage-messages' is 4191 bytes.

In Stores>Configuration>General>Web

My Default Cookie Settings are:

Cookie Lifetime: 3600(default)

Cookie Path:

Cookie Domain:

Use Http only: Yes

Cookie Restriction Mode: No

Does anybody have this issue? Can't find something related when I searched about

  • Any luck on your side finding anything about it? – ChaosTheoryV2X Aug 8 '19 at 20:31
  • @ChaosTheoryV2X No sorry... – G. G. Aug 29 '19 at 23:27
  • @G.G Did you solve this issue? – Mahi M Nov 29 '19 at 12:38

The error is because in the cookie mage-messages exists exception trace. Try to increase the value of \Magento\Framework\Stdlib\Cookie\PhpCookieManager::MAX_COOKIE_SIZE = 40960; And see in a browser response header value for set-cookie: mage-messages

  • This cookie checker is so ghetto, why not let the browser just tell you if you've overloaded its cookie allocations lol. – quickshiftin Apr 13 '20 at 20:46

Something is being set in the cookie that exceeds the size. This probably isn't expected behavior. To see what is being set, open vendor/magento/framework/Stdlib/Cookie/PhpCookieManager.php and change line 214-225 to;

if ($sizeOfCookie > static::MAX_COOKIE_SIZE) {
    throw new CookieSizeLimitReachedException(
        new Phrase(
            'Unable to send the cookie. Size of \'%name\' is %size bytes, value is %value',
                'name' => $name,
                'size' => $sizeOfCookie,
                'value' => $value

The error will now show what the contents of the to-be-set cookie would be.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.