Cannot read property 'session_expired' of null

I am sometimes getting the following error in Console:

Uncaught TypeError: Cannot read property 'session_expired' of null
    at Object.frappe.request.cleanup (desk.min.js:135)
    at Object.<anonymous> (desk.min.js:130)
    at i (jquery.min.js:2)
    at Object.fireWith [as rejectWith] (jquery.min.js:2)
    at z (jquery.min.js:4)
    at XMLHttpRequest.<anonymous> (jquery.min.js:4)

This happens when I open a custom html “page”. I think this is related to my system cache. how can I rectify this problem.

Edit: I have already ‘Reload’, ie clear cache and reload. but it didn’t work

It does not seems to be my system cache anymore. Have tried from two-three different systems. Also tried bench clear-cache.

It seems to be happening when I call a method from a “page” on a button click.


Hard to guess without code. Can you share code?


Make sure the args you are sending are not undefined.
I faced this problem today, and one of the properties in args was undefined. Avoid that.


As far as I can tell … it is not the problem here. However what did you do to rectify the error.

Another Thing which I just noticed … On top of the error I am also getting the following error

POST http://my-server-ip/ 404 (NOT FOUND)
send @ jquery.min.js:4
ajax @ jquery.min.js:4 @ desk.min.js:126 @ desk.min.js:122
start_internal_import @ VM93:78
(anonymous) @ VM93:72
dispatch @ jquery.min.js:3
$event.dispatch @ report.min.js:214
r.handle @ jquery.min.js:3

As I said earlier, I made sure the args were correct.

Ok. Anyways, Just a follow-up, I installed ERPNext on a fresh VM and am still facing the same errors. However it seems that the error is being generated only on that particular page.

I am not sure whether this could be helpful, but I don’t see any .pyc file being generated.

Now this seems to fix up. There was a syntax error with a ‘)’ missing in a .py file. Had to use python -m compileall . command

However just wondering why didn’t the system show a syntax error even in developer session (using bench serve)…And this .py file seemed to affect another py file with no correlation between them

Thanks a lot guys.