magento 2 invalid argument Related.php on line 129

If you see error just after removing related products and if you claim that you are innocent, you just removed the related / up sell / cross sell products but you are seeing error message something like following on product detail page.

Exception: invalid argument var/****/Related.php on line 129

Please do not waste your time on debugging. First try follwing:

Just disable and flush the cache from:

System > Tools > Cache Management

6 thoughts on “magento 2 invalid argument Related.php on line 129

    • Yes that was a temporary solution.
      Permanent solution that I made for this was, in my custom module I used Magento2’s plugin feature to override that specific function parameter, which was a array in foreach loop.
      I just override with condition, if that array is null set it to an empty array.

      Unfortunately I let that job as well code access last month, so I can not paste the code snippet here.
      You may contact me if you are lost.

  1. Hello nahidacm,

    I am facing the same problem on my Magento 2.1.4 installation. Only when the FPC is disabled, the problem disappears. That’s not a proper way of solving this though, so I was wondering if you could shed some light into this: What exactly causes it? Is it a bug that hasn’t been solved yet? If no product had related ones, would the problem occur? And how did you manage to solve it?

    Looking forward to your reply,
    Marilena.

    • Please use Magento 2 plugin feature to override that function.
      On that line line, you are having the error, if that array is null set it to an empty array.
      And wait for Magento to fix it.

  2. Hello,

    Thank you for replying. What is the M2 Plugin Feature? Is it an extension I can find in the marketplace? Or you just tamper with the php code in Related.php file and create an ‘if’ statement?

    Can you give me more information?

    Thanks again.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s