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

This error occurs when running Python scripts


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
XINSTALL BY CLICKING THE DOWNLOAD FILE
A message from our partner

For fixing Windows errors, we recommend Fortect:

Fortect will identify and deploy the correct fix for your Windows errors. Follow the 3 easy steps to get rid of Windows errors:

  • Download Fortect and install it on your PC
  • Launch the tool and Start scanning your PC for Windows errors
  • Right-click on Start Repair to deploy the right fix for each error encountered during the scan
Download Now Fortect has been downloaded by 0 readers this month, rated 4.6 on TrustPilot

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 https://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.

More about the topics: error

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

User forum

1 messages