22

I am seeing the error message in my JupyterLab.:

"Code Editor out of Sync. 
Please open your browser JavaScript console for bug report instructions" 

Jupyter Lab version 3.0.3 and Python version 3.7.7. I'm using both Chrome and Safari. I am still seeing the same issue.

enter image description here

Anirban Saha
  • 1,350
  • 2
  • 10
  • 38
user14986176
  • 237
  • 1
  • 2
  • 3
  • Please follow the community guideline on how to create a minimal reproducible example so the community can help you better: https://stackoverflow.com/help/minimal-reproducible-example. Also you should provide your browser's JS console log. – Mahdad Baghani Jan 11 '21 at 20:49
  • I have the same issue, except I get the pop up after I've created and edited the notebook using Azure ML Studio Notebook service and then try switching to JupyterLab. Not sure the version of Jupyter, but I think I'm using Python 3.6.9. https://learn.microsoft.com/en-us/azure/machine-learning/how-to-run-jupyter-notebooks – yeamusic21 Jan 12 '21 at 18:49
  • You should [open the browser console](https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_are_browser_developer_tools#How_to_open_the_devtools_in_your_browser) and follow the instructions to report it to JupyterLab contributors as an issue on [JupyterLab GitHub](https://github.com/jupyterlab/jupyterlab). – krassowski Jan 13 '21 at 12:20
  • 2
    I have the same issue using Chrome. It happens during editing with no need to execute code beforehand. It renders the JupyterLab unusable because as I write (or paste) code, get the error, save, exit, and reload the notebook I see that the new code is in the wrong place and splits wrong lines etc, thus giving syntax error when trying to run. The instructions above on how to go to the Java console are not clear to me. There is too much information on that link. Can someone write a short and concise step by step guide on how to do it in Chrome – Zvi Jan 24 '21 at 10:52

4 Answers4

24

I had the same problem after editing my Jupyterlab file in VS Code for Windows and then going back to Jupyterlab. The problem stems from my VS Code line ending settings. To fix the issue with the notebook I opened the notebook in the Jupyterlab Editor (1)

enter image description here

Scrolled down to confirm that line endings were \r\n (2)

enter image description here

Then Ctrl+F to find and replace all \r\n with \n (3)

enter image description here

Line endings should now be \n (4). You can now reopen the notebook.

enter image description here

Thanks @AdvaitShirvaikar for pointing me in the right direction!

user6481870
  • 1,289
  • 13
  • 9
13

Did you download and open your colab file in your local jupyter lab ?
If so, an easy fix is to open your .ipynb colab file in notepad/notepad++ (or any text editor) and replace all \r\n with \n
This worked for me!

  • 1
    WARNING: I tried it using notepad (windows 8.1) and then I could not load the file at all to Jupter Lab. Error: File Load Error for Project3_Model_E.ipynb Unreadable Notebook: Project3_Model_E.ipynb NotJSONError('Notebook does not appear to be JSON: \'\\ufeff{\\n "cells": [\\n {\\n "cell_typ...') – Zvi Mar 03 '21 at 10:20
6

Also, an other easy way that I found in my case was that it seems to be sufficient to create a new cell above / below the affected one, copy paste everything over and delete the old one.

Rahul Ranjan
  • 1,028
  • 1
  • 10
  • 27
0

I had the same issue, but the cause was different from \r\n. There are unique id's for each cell, but there were duplicate id's in my file after editing it using VS Code. You can check if there are duplicates using an editor like vim. Cutting those cells and pasting them back in Jupyter Notebook (not JupyterLab) solved the problem. Of course, I tried it using a backup file ;)

T_T
  • 1,202
  • 16
  • 22