Error while updating ajaxPartial

Rarely, one out of 50-100 requests goes through with an error, what could this be related to?
image

Inside ajaxPartial
<a
      data-request="onAjax"
      data-request-update="{_self:true}"
     >
      {{ option.title }}
    </a>

This is interesting, the _self value is replaced in JavaScript. It looks for <div data-ajax-partial="..."> element, if this element is gone, the error will happen. Or check the console for browser errors.

I tried to put the partial name instead of _self

"An exception has been thrown during the rendering of a template ("foreach() argument must be of type array|object, null given") in "path_to_partial_here" at line 16." on line 407 of site/vendor/twig/twig/src/Template.php

and error in console

the behavior is exactly the same, 1 out of 50-100 requests with this error