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. Commented Mar 3, 2020 at 3:27

2 Answers 2


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) Commented Mar 3, 2020 at 18:05

For me it was a configuration of some shipping extenstion (Inpost). I needed to go to admin and re-save the configuration. The re-saving is changing a way how the config is stored (serializing vs marshalling).

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.