New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File Save Error #3506

Open
dclong opened this Issue Jan 1, 2018 · 23 comments

Comments

Projects
None yet
@dclong

dclong commented Jan 1, 2018

I got the following error when saving a notebook.

File Save Error

'_xsrf' argument missing from POST

@blink1073

This comment has been minimized.

Member

blink1073 commented Jan 2, 2018

Hi @dclong, did this happen when refreshing a JupyterLab page after restarting the notebook server?
If you restart the server and it gets a new token that differs from the previous one, then the client will attempt to use the previous token, which will be rejected by the server. The server will then expect to see the _xsrf authentication, which would not have been provided by the client because it is using token authentication. We cannot provide both forms of authentication to the server.

I believe the way to avoid this is to use a password ( jupyter notebook password).

@dclong

This comment has been minimized.

dclong commented Jan 2, 2018

@blink1073
I'm using JupyterLab via JupyterHub. I don't know whether JupyterHub restarted the notebook server or not. JupyterHub is authenticated using password, however, I'm not sure how the underlying notebook server is authenticated. I need to read docs about JupyterHub on this.

@blink1073

This comment has been minimized.

Member

blink1073 commented Jan 2, 2018

Does this give a string value when entered into the browser web console? JSON.parse(document.getElementById('jupyter-config-data').textContent).token.

Also, does this give an answer that is not -1: document.cookie.indexOf('_xsrf')?

@dclong

This comment has been minimized.

dclong commented Jan 2, 2018

  1. JSON.parse(document.getElementById('jupyter-config-data').textContent).token returns an empty string.

  2. document.cookie.indexOf('_xsrf') returns 0

But as I mentioned I'm using JupyterHub and the issue is gone right now. I'll have a try of these 2 commands immediate if I come across the same issue again.

@blink1073

This comment has been minimized.

Member

blink1073 commented Jan 2, 2018

Great, thanks!

@sbailey

This comment has been minimized.

sbailey commented Mar 29, 2018

FYI, I had the same experience of a 403 error mentioning "'_xsrf' argument missing from POST" in the jupyter.log. Like @dclong I was using JupyterHub and I confirmed with the admins that it had not been restarted around the time of the problem.

It appeared to happen spontaneously: saving was working fine, and then 10 minutes later I started getting the 403 errors and couldn't save. I had been using the notebook for several days.

Anecdotally I'm under the impression that saving becomes flaky if the notebook loses the network connection unexpectedly, e.g. if I close my laptop without remembering to first close the browser window running the notebook from a remote JupyterLab / JupyterHub. When I come back to the notebook in that case sometimes it works, and sometimes it has problems saving after further updates. I've never had a problem when I've remembered to cleanly close the window (while leaving the notebook running on the remote server) and then reconnect from a new window later. I can't back this up with reproducible examples, but I mention this in case it is a clue.

@xguse

This comment has been minimized.

xguse commented May 17, 2018

does anyone have a method to recover from this? I would really like to not lose my work when this happens.

@damienrj

This comment has been minimized.

damienrj commented May 18, 2018

@xguse At least in my case restarting the notebook server without closing the notebook window allowed me to save the notebook.

@Honghe

This comment has been minimized.

Honghe commented Jun 13, 2018

Meet '_xsrf' argument missing from POST too when export draw.io to image.

  • Ubuntu 16.04
  • JSON.parse(document.getElementById('jupyter-config-data').textContent).token returns an empty string.
  • document.cookie.indexOf('_xsrf') returns 0
@tbenst

This comment has been minimized.

tbenst commented Jul 16, 2018

Encountered same problem. Here's how to reproduce (at least in Firefox on ubuntu):

  1. launch jupyter lab
  2. open an existing ipynb
  3. make changes (do not save)
  4. pkill firefox
  5. relaunch firefox
  6. make new changes to same ipynb and try to save
@cocoaaa

This comment has been minimized.

cocoaaa commented Sep 2, 2018

I get the same error when trying to export draw.io to image format.
JSON.parse(document.getElementById('jupyter-config-data').textContent).token returns a long string. I believe it's a token?

document.cookie.indexOf('_xsrf') returns 0

Here are other outputs from the web console:
image

  • Mac High Sierre 10.13.6

Can someone please explain what may be causing this, and any possible walk-arounds? How would I export a drawio file to an image in this case?

@blink1073 blink1073 added this to the 1.0 milestone Sep 4, 2018

@jasongrout jasongrout removed this from the 1.0 milestone Sep 5, 2018

@blink1073 blink1073 added the type:Bug label Sep 11, 2018

@blink1073 blink1073 added this to the Future milestone Sep 11, 2018

@AnaHristian

This comment has been minimized.

AnaHristian commented Sep 28, 2018

Had the same error spontaneously using Jupyter Notebook, I shutdown all the running notebooks, it took a few minutes and everything returned to normal, the autosaved message from the notebook appeared, I restarted the kernels and continued my work.

@johnyrufus

This comment has been minimized.

johnyrufus commented Oct 2, 2018

I lost 2 days work because of this, when i restarted, I could not see my work, and I had closed my old browser window after restart, is there a way to recover from this ?

@bdoury

This comment has been minimized.

bdoury commented Oct 5, 2018

I had the same issue today. Any chance someone is working on this bug?
Thanks

@jasongrout

This comment has been minimized.

Contributor

jasongrout commented Oct 5, 2018

@bdoury - was it with drawio for you too?

Edit: never mind, I see it's a much larger issue than drawio

@bdoury

This comment has been minimized.

bdoury commented Oct 5, 2018

@jasongrout, No it was not. To me it looks like the issue started while I was trying open a connection using cx_Oracle. After restarting my python environment and jupyterlab, the issue disappeared and I was not able to reproduce it. Sorry that I cannot be more specific.

@johntiger1

This comment has been minimized.

johntiger1 commented Oct 7, 2018

I can also reproduce the error via Amazon EC2 and JupyterLab.
It happens after my EC2 instance is stopped (while my JupyterLab is still up). I am also using the token, as opposed to a password

@Zohaggie

This comment has been minimized.

Zohaggie commented Oct 24, 2018

I sometimes get this if I am returning to a jupyter notebook (not lab) that has been running for some time, particularly if I am working on my Windows 10 laptop. I have found that if I open the same notebook again in a new window then it fixes the problem, and I can then close the newly opened notebook and continue working in the previously opened one.

@srividhyaprakash

This comment has been minimized.

srividhyaprakash commented Oct 30, 2018

There is a hand-wavy fix to this problem.

  1. Without closing the notebook that has this problem, Download the notebook as a .ipynb file.
  2. Open that .ipynb file. (It would have all the content from the previously saved point.
  3. Copy all the cells manually from this problematic notebook to the notebook you just downloaded and opened.
@shak360

This comment has been minimized.

shak360 commented Nov 10, 2018

I fixed this by simply closing and opening again my JupyterLab tab on Mozilla Firefox. I can't really find the root cause of the issue. I did have the notebook and Jupyter lab open for over 2 days which may have contributed to that error.

@zodoctor

This comment has been minimized.

zodoctor commented Nov 27, 2018

This happened to me a few times, and the problem fixed itself after a while from my laptop disconnecting and reconnecting to wifi. I essentially closed my laptop and opened it again a few times over the span of a few hours and eventually the notebook was able to reconnect and none of my work was lost. This definitely isn't a fix to the issue, but if you're in a pinch and worried you'll lose work, give this a try.

@jonnor

This comment has been minimized.

jonnor commented Jan 6, 2019

I just ran into this issue. Possibly also from reconnecting wifi and/or laptop suspend.

IHowever, after doing either
A) "Download .ipynb" (which got me a few hours old version) or B) "Make a copy" (opens old version in new window) the issue somehow resolved itself. The next "Save" was successful and stored the latest version. Maybe it updated the token somehow? So this is a possible workaround to avoid losing work.

@RiskofStorm

This comment has been minimized.

RiskofStorm commented Jan 11, 2019

I just ran right now at this issue. Restart Jupyter lab works just fine. Copy-paste all the code on temp file (don't lose your code!).
UPD: It seems my brain turned on and I found my NoJS addon blocked jupyter lab.

Console log error:

[W 12:29:23.308 LabApp] Could not determine jupyterlab build status without nodejs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment