'_Xsrf' argument missing from POST: 5 Ways to Fix it

This error occurs when running Python scripts

Reading time icon 3 min. read


Readers help support Windows Report. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help Windows Report sustain the editorial team Read more

Key notes

  • One way to deal with this issue is to disable xsrf checks.
  • Opening the notebook in your browser can also help.
Jupyter Notebook Not Saving: _Xsrf’ Argument Missing from POST

Many users have encountered the ‘_xsrf’ argument missing from POST message while running a script on Jupyter Notebooks, but there are ways to fix this issue.

What causes the _xsrf argument missing from post error?

Missing or expired CSRF tokens are the most common cause. If CSRF protection is disabled, you’ll also get this message. In some instances, browser extensions can cause this issue as well.

How can I fix the ‘_xsrf’ argument missing from POST error?

Before proceeding with any steps ensure that you don’t have LastPass extension installed or active. Also, check for token mismatch and refresh your browser.

1. Open the existing notebook

  1. Go to the Jupyter webpage.
  2. Click File, then select Open.Click File, then select Open.
  3. Choose another existing notebook with the .ipynb extension.
  4. Alternatively, you can navigate to File, then click New Notebook and create the notebook on the same kernel.New notebook - upyter Notebook Not Saving: _Xsrf’ Argument Missing from POST
  5. Now go back to the notebook with the _xsrf argument missing from POST error and click Save as to save it.
  6. In case you have closed the window where the error appeared, press the Windows key, type jupyter notebook in the search box, and click Open.
  7. Look for a link with http://localhost, then copy it.jupyter notebook -_Xsrf’ Argument Missing from POST
  8. Launch the browser and paste the link.

2. Open the tree endpoint

  1. Open your preferred browser and visit the tree endpoint.
  2. Press F5 to refresh your browser.
  3. Now, click New, then select Python 3 (ipykernel) from the drop-down menu.Open Python 3 - _Xsrf’ Argument Missing from POST
  4. Check if the issue persists.

3. Disable the xsrf checks

  1. Open the preferred terminal, then copy & paste the following command, and hit Enter: jupyter lab --ServerApp.disable_check_xsrf=True
  2. Now close the terminal and check if it resolves the issue.

4. Download the notebook

  1. Go to Jupyter Notebook, click File, then select Download as, then Notebook (.ipynb). Jupyter Notebook, click File, then select Download as, then Notebook (.ipynb) - _Xsrf’ Argument Missing from POST
  2. Go to File, then select Open from the drop-down menu.Click File, then select Open.
  3. Locate the downloaded .ipynb file and open it.

5. Interrupt the kernel

  1. On the Jupyter Notebook, click Kernel from the top menu.Interrupt kernel - _Xsrf’ Argument Missing from POST
  2. Click Interrupt.

If you are facing another error with Python, you can use the Try-except-print method; we have a separate guide to how to use it.

If you have more issues with Python, we also have guides on PermissionError Errno 13 and Python Runtime error that you should check.

To conclude, if you find yourself stuck with Xsrf’ Argument Missing from POST error while saving a script on Jupyter Notebook, you should check for the token expiry, incompatible browser extensions, or disable xsrf checks.

If you think your browser is causing this issue, you can check out the guide listing the best browsers for Jupyter Notebook before making an informed decision.

Did we miss a step that helped you fix the problem? Don’t hesitate to mention it in the comments section below. We will happily add it to the list.

User forum

0 messages