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? Aug 8, 2019 at 20:31
  • @ChaosTheoryV2X No sorry...
    – G. G.
    Aug 29, 2019 at 23:27
  • @G.G Did you solve this issue?
    – Mahi M
    Nov 29, 2019 at 12:38

3 Answers 3


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

  • 1
    This cookie checker is so ghetto, why not let the browser just tell you if you've overloaded its cookie allocations lol. Apr 13, 2020 at 20:46
  • 1
    You shouldn't increase the value as most browsers in 2021 have a limit of 4096 bytes for the cookie, which means that you get problems with the browser once you increase this value, see docs.microsoft.com/en-us/previous-versions/… Sep 6, 2021 at 12:39

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.

  • thanks it helps to identify from where issue is coming Jul 18, 2023 at 16:11

MDVA-41215 patch should resolve your issue: MDVA-41215: Users get 500 error after setting "mage-messages" cookie

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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