Unable to save changes after hours of inactivity

Warning: unable to save changes. Changes may be lost if you continue editing or close this window. Open this notebook in a new window to see which changes were saved.

I am often (daily) seeing a popup with this text on a notebook I leave open and idle in a browser tab for a while (e.g. overnight) after the 2.0 transition. I occasionally saw something similar before, but much less frequently (monthly?)

Thanks for the report.

I wouldn’t expect this warning to appear while the tab is idle because it’s only possible to trigger this warning when there are (new) changes to save. That suggests either there were already unsaved changes (and the saving spinner was spinning) when you backgrounded the tab, or you started editing after foregrounding the tab (and then encountered an error saving). We only try to save after you edit; there isn’t anything running continuously in the background. Do either of these scenarios sound plausible to you? Or is there anything else you can share about the conditions that trigger it?

That said, there’s currently no automatic recovery from this warning if you temporarily lose network connectivity (or experience a server error etc.). Currently we only attempt to save again after you make additional changes. So, I’d be curious if you continue editing when you see this warning, does the warning disappear? Or does it remain?

In the near future, we plan on improving the logic so that if you go offline, we detect when your computer comes back online again (by listening to online events) and reattempt to save. We should also retry if you get a transient network error, up to some number of retries (but not forever, with backoff). With these improvements you might still see the warning appear, but it should clear itself automatically if you are connected.

Edit: Actually, we do already try again to save if you interact with the notebook, even if you don’t subsequently edit. So unless you’re somehow getting signed out (?), or the notebook was deleted (?), I would expect this warning to recover automatically. More details would be appreciated!

I believe I know what’s going on here, and it’s indeed related to the tab being open for a long time.

We release new versions of Observable many times a day. We use Vercel Skew Protection to ensure that clients talk to their matching version on the server. (If we didn’t have skew protection, clients would often break unpredictably because they’d be talking to a different version of the server.)

Vercel Skew Protection by default only lasts for 12 hours. Normally this isn’t a problem because when you click around through the website, you automatically switch to the latest version when it becomes available. But it becomes a problem if you have a notebook open for more than 12 hours, because you haven’t done a full page load and are therefore still running the client version at the time you opened the notebook. Hence your save requests get rejected because your client’s version is no longer available on Vercel because it’s more than 12 hours old.

So indeed the only way to fix this is to reload the page so that you’re running the latest release of Observable (as the warning says).

I’ve updated skew protection to be 24 hours instead of 12 hours, which should help slightly, but not much. And I don’t want to extend the skew protection window much longer than that because it makes it harder for us to roll out certain changes (if old releases continue to run indefinitely).

Practically speaking, then, the only thing we could do here is to reload the notebook for you automatically when we detect that you’re running on an old client. For example when you foreground the notebook and we detect that the tab has been open for more than 12 hours, we could reload the page automatically so that subsequent saves succeed. And we could do this only conditionally if you don’t have unsaved changes so you don’t lose work. But you might still have ephemeral runtime state in your notebook you want to preserve… likely the best option, though. Let me know how that sounds.

I pushed a change to reload the notebook page when the tab is foregrounded and (1) the page has been open for more than 12 hours, (2) there are no unsaved changes, and (3) a new version of Observable is available. This should fix the save errors you’re seeing. Please let me know if you encounter any further issues. :folded_hands:

I just encountered this warning again on a notebook (here) that I left idle for about 1 hour (and which had not been open yet for 12 hours). The warning is triggered when I start to create a new cell and disappears if I cancel the creation. I am not experiencing any network issues. I will leave the notebook in an edited state for a while now to see if this resolves itself…

Can you try reloading the page before leaving the notebook idle? We just pushed the fix last night, so if the page has been open for a while, you wouldn’t have received the recent fixes. Thank you!

I haven’t seen the problem repeat since reloading.

I am editing the same notebook in a new browser tab and just got the “unable to save changes” warning during an editing session. When I opened the same notebook in a new tab, after about 5 mins, the warning disappeared and the new tab was not missing any edits. I can’t tell if opening the new tab actually had an effect or else the timing was coincidental.

I am continuing to have this problem with the same notebook and just noticed periodic “Too Many Requests” errors on my notebook URL in the console:

POST https://observablehq.com/@dkirkby/iris-rflex-model 429 (Too Many Requests)

For what it is worth, these errors always come in pairs but it is not obvious what I am doing in the UI (if anything) to trigger them.

It looks like you’re being rate limited, yes. I’ll investigate and see if we can fix. Thanks again for the report.

I am still encountering this problem daily, but have discovered that triggering the “Verifying Browser” phase in a separate tab generally resolves it, in case that helps track the cause of the 429s.

I just made a tweak to Vercel’s bot detection to hopefully allow this type of traffic (notebook saving) through consistently.

At the same time, I would hope it’d be generally smart enough to never think you’re a bot so let me know how often you’re seeing any “Verifying browser” pages because those may still be triggering but they shouldn’t be blocking you (hidden in console) from saving anymore.

I see the “Verifying your browser” message with a spinner lasting 1-2 seconds several times a day.