Error 'AttributeError: 'NoneType' object has no attribute 'kernel_ws_protocol''

Hello, we have internal instance of Jupyterlab, running on k8s cluster. After the moment I open UI, I usually experience several consecutive errors like:

[E 2023-11-17 12:07:44.475 ServerApp] 500 GET <some_path>/jupyter/api/kernels/153ad49f-6d1f-4f68-aa44-1e848b2b2dd7/channels?session_id=c3780625-5bd9-42cd-9a02-2a6dc46e3749 (266b9f0237614ad6885dbb74d6558310@ 33668.23ms referer=None
[E 2023-11-17 12:07:44.476 ServerApp] Uncaught exception GET <some_path>/jupyter/api/kernels/153ad49f-6d1f-4f68-aa44-1e848b2b2dd7/channels?session_id=c3780625-5bd9-42cd-9a02-2a6dc46e3749 (
    HTTPServerRequest(protocol='http', host='<some_host>:8080', method='GET', uri='<some_path>/jupyter/api/kernels/153ad49f-6d1f-4f68-aa44-1e848b2b2dd7/channels?session_id=c3780625-5bd9-42cd-9a02-2a6dc46e3749', version='HTTP/1.1', remote_ip='')
    Traceback (most recent call last):
      File "/opt/spark/work-dir/miniconda3/lib/python3.10/site-packages/tornado/", line 1786, in _execute
        result = await result
      File "/opt/spark/work-dir/.local/lib/python3.10/site-packages/jupyter_server/services/kernels/", line 65, in get
        await super().get(kernel_id=kernel_id)
      File "/opt/spark/work-dir/miniconda3/lib/python3.10/site-packages/tornado/", line 272, in get
        await self.ws_connection.accept_connection(self)
      File "/opt/spark/work-dir/miniconda3/lib/python3.10/site-packages/tornado/", line 862, in accept_connection
        await self._accept_connection(handler)
      File "/opt/spark/work-dir/miniconda3/lib/python3.10/site-packages/tornado/", line 902, in _accept_connection
        self.selected_subprotocol = handler.select_subprotocol(subprotocols)
      File "/opt/spark/work-dir/.local/lib/python3.10/site-packages/jupyter_server/services/kernels/", line 87, in select_subprotocol
        preferred_protocol = self.connection.kernel_ws_protocol
    AttributeError: 'NoneType' object has no attribute 'kernel_ws_protocol'

After those websocket is being opened and no further errors occure, nor any issues with functionality of jupyterlab I can detect:

[E 2023-11-17 12:07:44.477 ServerApp] 500 GET <some_path>/jupyter/api/kernels/153ad49f-6d1f-4f68-aa44-1e848b2b2dd7/channels?session_id=c3780625-5bd9-42cd-9a02-2a6dc46e3749 (2367bf49cb2f4e97a05df0b79a8909ea@ 28037.39ms referer=None
[D 2023-11-17 12:07:44.477 ServerApp] 101 GET <some_path>/jupyter/api/kernels/153ad49f-6d1f-4f68-aa44-1e848b2b2dd7/channels?session_id=c3780625-5bd9-42cd-9a02-2a6dc46e3749 (2367bf49cb2f4e97a05df0b79a8909ea@ 2884.24ms
[D 2023-11-17 12:07:44.477 ServerApp] Opening websocket <some_path>/jupyter/api/kernels/153ad49f-6d1f-4f68-aa44-1e848b2b2dd7/channels

I failed so far to locate the root-cause of this error, if anybody has any ideas on what can cause it, the help is greatly appreciated.

This looks like incompatibility in some package versions. Can you run pip check (assuming you use pip not conda) and jupyter --version and report the outputs?

It was also reported in 'NoneType' object has no attribute 'kernel_ws_protocol' · Issue #1265 · jupyter-server/jupyter_server · GitHub.

Thanks for your answer, here is the output of these commands

bash-4.2$ which pip3
bash-4.2$ pip3 check
conda 23.10.0 has requirement ruamel-yaml<0.18,>=0.11.14, but you have ruamel-yaml 0.18.5.
bash-4.2$ jupyter --version
Selected Jupyter core packages...
IPython          : 8.17.2
ipykernel        : 6.26.0
ipywidgets       : not installed
jupyter_client   : 8.6.0
jupyter_core     : 5.5.0
jupyter_server   : 2.10.1
jupyterlab       : 4.0.8
nbclient         : 0.9.0
nbconvert        : 7.11.0
nbformat         : 5.9.2
notebook         : not installed
qtconsole        : not installed
traitlets        : 5.13.0
bash-4.2$ which pip
bash-4.2$ pip check
conda 23.10.0 has requirement ruamel-yaml<0.18,>=0.11.14, but you have ruamel-yaml 0.18.5.

Asked here as well, no solution was found so far

Recently I encountered the same error, did you found solutions?
I also have this error:tornado.websocket.WebSocketClosedError
I have the error only when I want to connect Jupyter with my conda R env. my conda python envs are perfectly fine with Jupiyter.
I am already trouble shooting for few days, no luck yet.

Hi, unfortunately I still have no solution for this issue

Thanks for the reply.
Now I change to vs-code, the jupyter works there.