I'm on Magneto 2.3.4. In vendor/magento/module-checkout/view/frontend/templates/onepage.phtml there's a line like this:

        window.checkoutConfig = <?= /* @noEscape */ $block->getSerializedCheckoutConfig() ?>;

Following the function, it comes down to vendor/magento/module-checkout/Block/Onepage.php::getSerializedCheckoutConfig()

And the serialize function is in vendor/magento/framework/Serialize/Serializer/JsonHexTag.php

I added json_last_error_msg() to the exception message, and basically the error message is now:

Exception #0 (InvalidArgumentException): 
Unable to serialize value. Error:Malformed UTF-8 characters, possibly incorrectly encoded

How to quickly find the checkout configuration value or key that is having malformed UTF-8 characters? Or how to quickly fix this in database?

  • You should know how to use XDebug. It's easier for you to check root cause. Mar 3, 2020 at 3:27

1 Answer 1


In the past, I faced the same issue. In my case, a custom payment config encryption caused that issue. Please check the config with encryption, for example: token, password,...

  • 1
    Great suggestion, i was able to debug and find the malformed config value using mb_detect_encoding($suspiciousString, 'UTF-8', true) Mar 3, 2020 at 18:05

Your Answer

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

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