Magento – Unexpected end of JSON input after cache cleaned

javascriptjsonmagento-2.1.9magento2

I am always getting an Unexpected end of JSON input error after clearing my caches cache:clean | cache:flush.
But this error only happens on first page load.
When I reload the page again it is gone.

Here are some details:

Uncaught SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at callback ((index):464)
    at Object.execCb (require.js:1651)
    at Module.check (require.js:867)
    at Module.<anonymous> (require.js:1114)
    at require.js:133
    at require.js:1157
    at each (require.js:58)
    at Module.emit (require.js:1156)
    at Module.check (require.js:918)

I couldnt figure out from where its coming. Does anyone of you has an idead how to fix this or what is causing the error?

Best Answer

I had this problem, and I identified that

I had left some cms block with the field

data-mage-init = {

that is,

without closing the tag } json