Jupyter / IJulia: Cell containing code suddenly turned blank

I’m working in a Jupyter Notebook and while in the midst of typing code, the cell I was typing in suddenly turned blank. When I try clicking on the blank cell, nothing happens. I can run the cell by clicking the little black arrow in the top left corner and a syntax error shows up below the cell, suggesting that the code is still in there but just isn’t visible.

I have no idea what I did or how to get my code back. I think maybe I hit some keyboard shortcut by mistake? Does anyone know what this means, or how to get my code back? Here’s a screenshot:

2 Likes

I don’t know about what caused it but maybe copying from the cell “blindly” to extract your code should work? Or afterall, a notebook is a JSON file so you should be able to open your .ipynb notebook with a text editor and extract it from there (if it is saved).

1 Like

Hi, thanks for your reply. Weirdly I can see the contents now. I highlighted the cell, went to the dropdown menu on the toolbar and selected “Raw NBConvert.” Except it’s not quite a normal cell now. I tried selecting “Code” and “header” from the dropdown menu also, and now it looks like this:

I have no idea what is going on…

I just reverted to the last checkpoint so I’m ok for now. But it’d be nice to know what I did to screw things up so I can avoid doing it again in the future.

I have also run into this issue (I think). Sometimes the cell becomes non-responsive, sometimes clicking adds a random subset of the text to the cell again, and usually after that all occurs for a bit, the cell goes blank. I have learned to just stop clicking and manually copy the text to the next cell and delete the original.

It’s hard to imagine a use case where this is actually desirable and intended behavior, but stranger things have happened before.

1 Like

It also seems like it would be browser-side rather than the notebook files messing up since

Which browser are you using? My issues happen on a Chrome variant (Brave). I have not investigated whether the same problems occur on other

I remember a strange bug in Jupyter that caused this behavior if you hit “.0”: [julia mode] Typing .0 breaks jupyter cell · Issue #6288 · codemirror/CodeMirror · GitHub

This should be fixed in later versions of jupyter, so try updating everything related to it, including the notebook, IJulia, etc. and see if that fixes the problem.

1 Like

I’m using Firefox.

Hmm interesting. Thankfully, I don’t get an error when I type “.0”. Also, I’m using a very new installation of Jupyter notebook so I don’t think it’s the same bug.

I experienced exactly what you just described! And it happened again yesterday and I’m pretty sure I did not hit a keyboard shortcut. My current approach is to just save + checkpoint very often.

I’ve now had this issue occur 3 times in the last 15 minutes. How can we report this as a bug?

In the meantime, does anyone have any suggestions for alternatives to Jupyter notebook?