Coding error detected, it must be fixed by a programmer: Failed to unserialise data from file. Either failed to read, or failed to write.

Coding error detected, it must be fixed by a programmer: Failed to unserialise data from file. Either failed to read, or failed to write.

by Web Developer -
Number of replies: 3

If any one get this error then there is a simple way to solve this issue:

delete the cache folder from your moodledata directory and reload your website

Average of ratings: Useful (3)
In reply to Web Developer

Re: Coding error detected, it must be fixed by a programmer: Failed to unserialise data from file. Either failed to read, or failed to write.

by lior gil -
Picture of Core developers
Manually deleting the folder is more of the last resort type. I would first try doing it through the built in option.
Either through the web page

/admin/purgecaches.php
Or the CLI
php moodle/admin/cli/purge_caches.php
Average of ratings: Useful (1)
In reply to Web Developer

Re: Coding error detected, it must be fixed by a programmer: Failed to unserialise data from file. Either failed to read, or failed to write.

by Kurt Armbruster -
I tried the solution from here: https://coderwall.com/p/py-nba/moodle-easy-solution-to-failed-to-unserialise-data-from-file-either-failed-to-read-or-failed-to-write
When I run php /moodle/admin/cli/purge_caches.php from my xampp console, I get the exact same "failed to unserialize" message in the console that shows up in a browser.

And when I look in moodledata/cache, it's empty.


Empty cache folder


Even .../admin/purgedata.php gets the error:
Coding error detected, it must be fixed by a programmer: Failed to unserialise data from file. Either failed to read, or fail
In reply to Kurt Armbruster

Re: Coding error detected, it must be fixed by a programmer: Failed to unserialise data from file. Either failed to read, or failed to write.

by Kurt Armbruster -
Issue resolved. As it happens, I had 2 folders that were labeled moodledata. I had cleared the cache in the wrong folder.
Average of ratings: Useful (2)