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:

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).

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.

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”: https://github.com/codemirror/CodeMirror/issues/6288

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.

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?

having the same issue on jupyter lab IJulia / kernel Julia 1.6.0 / iPadOS / Safari

Code not containing any .0

It’s probably a problem in the Julia mode of CodeMirror, which is the text editor used in Jupyter. If you can contrive a reproducible example (“type ‘x’ in Julia mode and the cell disappears”) you should file a codemirror issue.