Kotlin / kotlin-jupyter

Kotlin kernel for Jupyter/IPython
Apache License 2.0
1.12k stars 105 forks source link

Jupyter reports Kernel message validation error #460

Open ajrouvoet opened 7 months ago

ajrouvoet commented 7 months ago

First of all: great work on this. I'm impressed by how well this all works and I'm happy to see Kotlin compete with Python's dominance in data science.

I have set up Jupyter integration for a (closed source) Kotlin library. It generally works well, but I'm seeing some issues where sometimes the kernel seems to stop responding, or possibly delivering malformed responses. It always goes wrong on the re-evaluation of a cell whose response is HTML. Restarting the kernel and re-evaluating everything yields correct results.

On re-evaluation of such cells, I get console errors such as:

Uncaught SyntaxError: Kernel message validation error: JSON.parse: unexpected character at line 1 column 1 of the JSON data
    t http://localhost:8889/static/lab/jlab_core.33f047ff2ca794a7104f.js?v=33f047ff2ca794a7104f:1
    l http://localhost:8889/static/lab/jlab_core.33f047ff2ca794a7104f.js?v=33f047ff2ca794a7104f:1
    _onWSMessage http://localhost:8889/static/lab/jlab_core.33f047ff2ca794a7104f.js?v=33f047ff2ca794a7104f:1
    _createSocket http://localhost:8889/static/lab/jlab_core.33f047ff2ca794a7104f.js?v=33f047ff2ca794a7104f:1
    setTimeout handler*_reconnect http://localhost:8889/static/lab/jlab_core.33f047ff2ca794a7104f.js?v=33f047ff2ca794a7104f:1
    reconnect http://localhost:8889/static/lab/jlab_core.33f047ff2ca794a7104f.js?v=33f047ff2ca794a7104f:1
    restart http://localhost:8889/static/lab/jlab_core.33f047ff2ca794a7104f.js?v=33f047ff2ca794a7104f:1
    restartKernel http://localhost:8889/static/lab/jlab_core.33f047ff2ca794a7104f.js?v=33f047ff2ca794a7104f:1
    restart http://localhost:8889/static/lab/jlab_core.33f047ff2ca794a7104f.js?v=33f047ff2ca794a7104f:1
    execute http://localhost:8889/static/lab/jlab_core.33f047ff2ca794a7104f.js?v=33f047ff2ca794a7104f:1
    execute http://localhost:8889/static/lab/jlab_core.33f047ff2ca794a7104f.js?v=33f047ff2ca794a7104f:1
    execute http://localhost:8889/static/lab/jlab_core.33f047ff2ca794a7104f.js?v=33f047ff2ca794a7104f:1
    execute http://localhost:8889/static/lab/jlab_core.33f047ff2ca794a7104f.js?v=33f047ff2ca794a7104f:1
    m http://localhost:8889/static/lab/jlab_core.33f047ff2ca794a7104f.js?v=33f047ff2ca794a7104f:1
    s http://localhost:8889/static/lab/jlab_core.33f047ff2ca794a7104f.js?v=33f047ff2ca794a7104f:1
    Ue http://localhost:8889/static/lab/3935.905285b8e22c337968ed.js?v=905285b8e22c337968ed:2
    Qe http://localhost:8889/static/lab/3935.905285b8e22c337968ed.js?v=905285b8e22c337968ed:2
    je http://localhost:8889/static/lab/3935.905285b8e22c337968ed.js?v=905285b8e22c337968ed:2
    al http://localhost:8889/static/lab/3935.905285b8e22c337968ed.js?v=905285b8e22c337968ed:2
    ul http://localhost:8889/static/lab/3935.905285b8e22c337968ed.js?v=905285b8e22c337968ed:2
    dl http://localhost:8889/static/lab/3935.905285b8e22c337968ed.js?v=905285b8e22c337968ed:2
    Os http://localhost:8889/static/lab/3935.905285b8e22c337968ed.js?v=905285b8e22c337968ed:2
    De http://localhost:8889/static/lab/3935.905285b8e22c337968ed.js?v=905285b8e22c337968ed:2
    dl http://localhost:8889/static/lab/3935.905285b8e22c337968ed.js?v=905285b8e22c337968ed:2
    lt http://localhost:8889/static/lab/3935.905285b8e22c337968ed.js?v=905285b8e22c337968ed:2
    tt http://localhost:8889/static/lab/3935.905285b8e22c337968ed.js?v=905285b8e22c337968ed:2
jlab_core.33f047ff2ca794a7104f.js:1:1262200

The Jupyter server log shows nothing irregular in my eyes. Looks to me like the proper response is composed:

176533 [main] DEBUG o.j.k.j.protocol.SocketWrapper - [SHELL] >rcv: msg[ZTViYmY1M2QtYTI3My00ZWM1LWIwZmItZWM3YTY2YTA5MTFm] {"header":{"date":"2024-05-02T11:28:11.008Z","msg_id":"6cdbbdb7-146e-4722-b784-e053640e2499","msg_type":"execute_request","session":"e5bbf53d-a273-4ec5-b0fb-ec7a66a0911f","username":"","version":"5.2"},"parent_header":null,"metadata":{"ExecuteTime":{"end_time":"2024-05-02T08:03:29.181632246Z","start_time":"2024-05-02T08:03:29.011641910Z"},"trusted":true,"editable":true,"slideshow":{"slide_type":""},"tags":[],"deletedCells":[],"recordTiming":false,"cellId":"6b85c575454723c4"},"content":{"silent":false,"store_history":true,"user_expressions":{},"allow_stdin":true,"stop_on_error":true,"code":"import tno.algebra.*\n\nval grid = BoundedGrid(BoundingBox(-31, -30, 30, 30), Grid(5))\n\nval access = (square(6, 6, -3, -3)) or square(3, 3, 2, 2) or square(3, 3, -5, -5)\n\nAccessMap(grid, access)"}} 
176534 [main] DEBUG o.j.k.j.protocol.SocketWrapper - [IOPUB] snd>: msg[ZTViYmY1M2QtYTI3My00ZWM1LWIwZmItZWM3YTY2YTA5MTFm] {"header":{"msg_id":"db658db6-8d4f-4405-b1ab-29f28b4a81f3","msg_type":"status","session":"e5bbf53d-a273-4ec5-b0fb-ec7a66a0911f","username":"","version":"5.3","date":"2024-05-02T13:28:11.010735361+02:00[Europe/Amsterdam]"},"parent_header":{"msg_id":"6cdbbdb7-146e-4722-b784-e053640e2499","msg_type":"execute_request","session":"e5bbf53d-a273-4ec5-b0fb-ec7a66a0911f","username":"","version":"5.2","date":"2024-05-02T11:28:11.008Z"},"metadata":null,"content":{"execution_state":"busy"}} 
176535 [main] DEBUG o.j.k.j.protocol.SocketWrapper - [IOPUB] snd>: msg[ZTViYmY1M2QtYTI3My00ZWM1LWIwZmItZWM3YTY2YTA5MTFm] {"header":{"msg_id":"af64b574-3672-4e90-a5b9-d608916ba95b","msg_type":"execute_input","session":"e5bbf53d-a273-4ec5-b0fb-ec7a66a0911f","username":"","version":"5.3","date":"2024-05-02T13:28:11.011577066+02:00[Europe/Amsterdam]"},"parent_header":{"msg_id":"6cdbbdb7-146e-4722-b784-e053640e2499","msg_type":"execute_request","session":"e5bbf53d-a273-4ec5-b0fb-ec7a66a0911f","username":"","version":"5.2","date":"2024-05-02T11:28:11.008Z"},"metadata":null,"content":{"code":"import tno.algebra.*\n\nval grid = BoundedGrid(BoundingBox(-31, -30, 30, 30), Grid(5))\n\nval access = (square(6, 6, -3, -3)) or square(3, 3, 2, 2) or square(3, 3, -5, -5)\n\nAccessMap(grid, access)","execution_count":8}} 
176537 [Execution of code 'import tno.algebra.*...'] DEBUG o.j.k.j.r.impl.ReplForJupyterImpl - Current cell id: 8 
176537 [Execution of code 'import tno.algebra.*...'] DEBUG o.j.k.j.repl.impl.CellExecutorImpl - Executing code:
import tno.algebra.*

val grid = BoundedGrid(BoundingBox(-31, -30, 30, 30), Grid(5))

val access = (square(6, 6, -3, -3)) or square(3, 3, 2, 2) or square(3, 3, -5, -5)

AccessMap(grid, access) 
176538 [Execution of code 'import tno.algebra.*...'] DEBUG o.j.k.j.repl.impl.CellExecutorImpl - Adding 0 libraries 
176692 [Execution of code 'import tno.algebra.*...'] DEBUG o.j.k.j.libraries.LibrariesScanner - Acceptance result for tno.choreograph.ChoreographJupyterIntegration: null 
176692 [Execution of code 'import tno.algebra.*...'] DEBUG o.j.k.j.libraries.LibrariesScanner - Acceptance result for org.jetbrains.kotlinx.dataframe.jupyter.Integration: null 
176692 [Execution of code 'import tno.algebra.*...'] DEBUG o.j.k.j.libraries.LibrariesScanner - Acceptance result for org.jetbrains.kotlinx.kandy.letsplot.jupyter.Integration: null 
176692 [Execution of code 'import tno.algebra.*...'] DEBUG o.j.k.j.libraries.LibrariesScanner - Acceptance result for org.jetbrains.kotlinx.kandy.Integration: null 
176692 [Execution of code 'import tno.algebra.*...'] DEBUG o.j.k.j.libraries.LibrariesScanner - Acceptance result for org.jetbrains.kotlinx.statistics.jupyter.Integration: null 
176692 [Execution of code 'import tno.algebra.*...'] DEBUG o.j.k.j.libraries.LibrariesScanner - Scanning for libraries is done. Detected FQNs: {} 
176692 [Execution of code 'import tno.algebra.*...'] DEBUG o.j.k.j.libraries.LibrariesScanner - Number of detected definitions: 0 
176699 [main] DEBUG o.j.k.j.protocol.SocketWrapper - [IOPUB] snd>: msg[ZTViYmY1M2QtYTI3My00ZWM1LWIwZmItZWM3YTY2YTA5MTFm] {"header":{"msg_id":"3c788b2f-d08b-464e-b3b1-b31d5becf3f2","msg_type":"execute_result","session":"e5bbf53d-a273-4ec5-b0fb-ec7a66a0911f","username":"","version":"5.3","date":"2024-05-02T13:28:11.175025146+02:00[Europe/Amsterdam]"},"parent_header":{"msg_id":"6cdbbdb7-146e-4722-b784-e053640e2499","msg_type":"execute_request","session":"e5bbf53d-a273-4ec5-b0fb-ec7a66a0911f","username":"","version":"5.2","date":"2024-05-02T11:28:11.008Z"},"metadata":null,"content":{"data":{"text/html":"<div id=\"accessmap-1362665863\" style=\"width: 750px; height: 750px;\"></div>\n<script>\n    window.choreograph.createAccessMap(\n        document.getElementById('accessmap-1362665863'),\n        JSON.parse('{\"grid\":{\"bounds\":{\"topLeft\":[-31,-30],\"bottomRight\":[30,30]},\"grid\":{\"cellSize\":5,\"origin\":[0,0]},\"localOrigin\":[-30,-30]},\"access\":[[false,false,false,false,false,false,false,false,false,false,false,false],[false,true,true,true,false,false,false,false,false,false,false,false],[false,true,true,true,false,false,false,false,false,false,false,false],[false,true,true,true,true,true,true,true,true,false,false,false],[false,false,false,true,true,true,true,true,true,false,false,false],[false,false,false,true,true,true,true,true,true,false,false,false],[false,false,false,true,true,true,true,true,true,false,false,false],[false,false,false,true,true,true,true,true,true,false,false,false],[false,false,false,true,true,true,true,true,true,true,true,false],[false,false,false,false,false,false,false,false,true,true,true,false],[false,false,false,false,false,false,false,false,true,true,true,false],[false,false,false,false,false,false,false,false,false,false,false,false]]}')\n    )\n</script>"},"metadata":{},"execution_count":8}} 
176700 [main] DEBUG o.j.k.j.protocol.SocketWrapper - [SHELL] snd>: msg[ZTViYmY1M2QtYTI3My00ZWM1LWIwZmItZWM3YTY2YTA5MTFm] {"header":{"msg_id":"52d31e2a-181d-4fe9-a43d-aede000ff7ff","msg_type":"execute_reply","session":"e5bbf53d-a273-4ec5-b0fb-ec7a66a0911f","username":"","version":"5.3","date":"2024-05-02T13:28:11.176090353+02:00[Europe/Amsterdam]"},"parent_header":{"msg_id":"6cdbbdb7-146e-4722-b784-e053640e2499","msg_type":"execute_request","session":"e5bbf53d-a273-4ec5-b0fb-ec7a66a0911f","username":"","version":"5.2","date":"2024-05-02T11:28:11.008Z"},"metadata":{"engine":"e5bbf53d-a273-4ec5-b0fb-ec7a66a0911f","status":"ok","started":"2024-05-02T13:28:11.010541059+02:00[Europe/Amsterdam]","eval_metadata":{"newClasspath":[],"newSources":[],"compiledData":{"scripts":[],"sources":[]},"newImports":["tno.algebra.*","tno.algebra.*"],"evaluatedVariablesState":{"access":"","grid":"","history":"","initial":"","trails":"","world":"","dataFrameConfig":"","kandyConfig":"","coverage":""}}},"content":{"status":"ok","execution_count":8}} 
176701 [main] DEBUG o.j.k.j.protocol.SocketWrapper - [IOPUB] snd>: msg[ZTViYmY1M2QtYTI3My00ZWM1LWIwZmItZWM3YTY2YTA5MTFm] {"header":{"msg_id":"5c5873a8-6707-43c6-9508-2da5916a0c28","msg_type":"status","session":"e5bbf53d-a273-4ec5-b0fb-ec7a66a0911f","username":"","version":"5.3","date":"2024-05-02T13:28:11.177187359+02:00[Europe/Amsterdam]"},"parent_header":{"msg_id":"6cdbbdb7-146e-4722-b784-e053640e2499","msg_type":"execute_request","session":"e5bbf53d-a273-4ec5-b0fb-ec7a66a0911f","username":"","version":"5.2","date":"2024-05-02T11:28:11.008Z"},"metadata":null,"content":{"execution_state":"idle"}} 
176702 [main] DEBUG o.j.k.j.protocol.SocketWrapper - [SHELL] >rcv: msg[ZTViYmY1M2QtYTI3My00ZWM1LWIwZmItZWM3YTY2YTA5MTFm] {"header":{"date":"2024-05-02T11:28:11.011Z","msg_id":"96b2485e-2dc7-4a98-a141-22eea86b7aff","msg_type":"complete_request","session":"e5bbf53d-a273-4ec5-b0fb-ec7a66a0911f","username":"","version":"5.2"},"parent_header":null,"metadata":null,"content":{"code":"import tno.algebra.*\n\nval grid = BoundedGrid(BoundingBox(-31, -30, 30, 30), Grid(5))\n\nval access = (square(6, 6, -3, -3)) or square(3, 3, 2, 2) or square(3, 3, -5, -5)\n\nAccessMap(grid, access)","cursor_pos":192}} 
176783 [DefaultDispatcher-worker-4] DEBUG o.j.k.j.protocol.SocketWrapper - [IOPUB] snd>: msg[ZTViYmY1M2QtYTI3My00ZWM1LWIwZmItZWM3YTY2YTA5MTFm] {"header":{"msg_id":"a2f62176-d119-40e7-9cb7-574b3ef7a3b2","msg_type":"status","session":"e5bbf53d-a273-4ec5-b0fb-ec7a66a0911f","username":"","version":"5.3","date":"2024-05-02T13:28:11.259605954+02:00[Europe/Amsterdam]"},"parent_header":{"msg_id":"96b2485e-2dc7-4a98-a141-22eea86b7aff","msg_type":"complete_request","session":"e5bbf53d-a273-4ec5-b0fb-ec7a66a0911f","username":"","version":"5.2","date":"2024-05-02T11:28:11.011Z"},"metadata":null,"content":{"execution_state":"busy"}} 
176785 [DefaultDispatcher-worker-4] DEBUG o.j.k.j.protocol.SocketWrapper - [SHELL] snd>: msg[ZTViYmY1M2QtYTI3My00ZWM1LWIwZmItZWM3YTY2YTA5MTFm] {"header":{"msg_id":"dff115f7-1449-4ffa-bcce-4970a350000b","msg_type":"complete_reply","session":"e5bbf53d-a273-4ec5-b0fb-ec7a66a0911f","username":"","version":"5.3","date":"2024-05-02T13:28:11.259403652+02:00[Europe/Amsterdam]"},"parent_header":{"msg_id":"96b2485e-2dc7-4a98-a141-22eea86b7aff","msg_type":"complete_request","session":"e5bbf53d-a273-4ec5-b0fb-ec7a66a0911f","username":"","version":"5.2","date":"2024-05-02T11:28:11.011Z"},"metadata":null,"content":{"status":"ok","matches":[],"cursor_start":192,"cursor_end":192,"paragraph":{"cursor":192,"text":"import tno.algebra.*\n\nval grid = BoundedGrid(BoundingBox(-31, -30, 30, 30), Grid(5))\n\nval access = (square(6, 6, -3, -3)) or square(3, 3, 2, 2) or square(3, 3, -5, -5)\n\nAccessMap(grid, access)"},"metadata":{"_jupyter_types_experimental":[],"_jupyter_extended_metadata":[]}}} 
176786 [DefaultDispatcher-worker-4] DEBUG o.j.k.j.protocol.SocketWrapper - [IOPUB] snd>: msg[ZTViYmY1M2QtYTI3My00ZWM1LWIwZmItZWM3YTY2YTA5MTFm] {"header":{"msg_id":"2dc59f2a-e82c-4e6a-bae2-744b79dce366","msg_type":"status","session":"e5bbf53d-a273-4ec5-b0fb-ec7a66a0911f","username":"","version":"5.3","date":"2024-05-02T13:28:11.261740566+02:00[Europe/Amsterdam]"},"parent_header":{"msg_id":"96b2485e-2dc7-4a98-a141-22eea86b7aff","msg_type":"complete_request","session":"e5bbf53d-a273-4ec5-b0fb-ec7a66a0911f","username":"","version":"5.2","date":"2024-05-02T11:28:11.011Z"},"metadata":null,"content":{"execution_state":"idle"}}

Perhaps I'm also barking up the wrong tree here: I have no strong indication that this is coming from the Kotlin kernel, but I'm suspicious because first evaluation goes correct and because the error seems to surface on some re-evaluations, but not every.

The errors happen both in Jupyterlab frontend and the classic notebooks.

I'd be happy to supply more information if you can tell me how to obtain it.

ajrouvoet commented 7 months ago

Actually it looks like a simpler example already has problems.

Using:

And the attached notebook, I get into a seemingly failed state by just re-evaluating the last cell a bunch of times. The first few times I get the correct output, but eventually (after 2-n re-evaluations, randomly) it gets stuck. The cell shows 'busy' and so does the kernel status, but no response comes and no errors in the Jupyter server output.

example.zip

ileasile commented 7 months ago

Hi! does it work with other versions of kernel (previous one)?

ajrouvoet commented 7 months ago

Thanks for your reply. I've tried:

With similar results on the provided example notebook.

In the below screenshot you can see the asterisk for the cell being evaluated, but the kernel status indicator showing 'idle'. The first 6 evaluations all yielded the desired graph output, the 7th yielded this stuck state:

image

ajrouvoet commented 7 months ago

A test with Jupyter 5.7.2 makes it seem harder to reproduce the failure condition; but because it occurs randomly it is hard to tell. I'm not sure how likely it is that this is the Kotlin kernel's problem.

ileasile commented 7 months ago

Uncaught SyntaxError: Kernel message validation error: JSON.parse:

It is the error inside the browser, right? If yes, could you please try to extract the JSON that cannot be parsed (inside a debugger?)

ileasile commented 7 months ago

And could you please copy the contents of the notebook the screenshot of which you made

ajrouvoet commented 6 months ago

Apologies for the delay; I tried to reply by Github e-mail, but apparently it did not work.

And could you please copy the contents of the notebook the screenshot of which you made

I had attached that notebook in an above comment as example.zip.

I haven't been able yet to pinpoint the data that produces the browser console error, but I did now come across errors on the server console that look similar:

[E 2024-05-08 14:23:10.860 ServerApp] Uncaught exception in ZMQStream callback
    Traceback (most recent call last):
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 584, in _run_callback
        f = callback(*args, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 308, in stream_callback
        return callback(self, msg)
               ^^^^^^^^^^^^^^^^^^^
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 508, in handle_outgoing_message
        if self._limit_rate(channel, msg, parts):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 657, in _limit_rate
        msg["header"] = self.get_part("header", msg["header"], msg_list)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 524, in get_part
        value = self.session.unpack(msg_list[field2idx[field]])
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_client/session.py", line 124, in json_unpacker
        return json.loads(s)
               ^^^^^^^^^^^^^
      File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/__init__.py", line 346, in loads
        return _default_decoder.decode(s)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 337, in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 355, in raw_decode
        raise JSONDecodeError("Expecting value", s, err.value) from None
    json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[E 2024-05-08 14:23:10.860 ServerApp] Uncaught exception in zmqstream callback
    Traceback (most recent call last):
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 634, in _handle_events
        self._handle_recv()
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 663, in _handle_recv
        self._run_callback(callback, msg)
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 584, in _run_callback
        f = callback(*args, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 308, in stream_callback
        return callback(self, msg)
               ^^^^^^^^^^^^^^^^^^^
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 508, in handle_outgoing_message
        if self._limit_rate(channel, msg, parts):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 657, in _limit_rate
        msg["header"] = self.get_part("header", msg["header"], msg_list)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 524, in get_part
        value = self.session.unpack(msg_list[field2idx[field]])
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_client/session.py", line 124, in json_unpacker
        return json.loads(s)
               ^^^^^^^^^^^^^
      File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/__init__.py", line 346, in loads
        return _default_decoder.decode(s)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 337, in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 355, in raw_decode
        raise JSONDecodeError("Expecting value", s, err.value) from None
    json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Exception in callback BaseAsyncIOLoop._handle_events(29, 1)
handle: <Handle BaseAsyncIOLoop._handle_events(29, 1)>
Traceback (most recent call last):
  File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/asyncio/events.py", line 84, in _run
    self._context.run(self._callback, *self._args)
  File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/tornado/platform/asyncio.py", line 192, in _handle_events
    handler_func(fileobj, events)
  File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 634, in _handle_events
    self._handle_recv()
  File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 663, in _handle_recv
    self._run_callback(callback, msg)
  File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 584, in _run_callback
    f = callback(*args, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 308, in stream_callback
    return callback(self, msg)
           ^^^^^^^^^^^^^^^^^^^
  File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 508, in handle_outgoing_message
    if self._limit_rate(channel, msg, parts):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 657, in _limit_rate
    msg["header"] = self.get_part("header", msg["header"], msg_list)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 524, in get_part
    value = self.session.unpack(msg_list[field2idx[field]])
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_client/session.py", line 124, in json_unpacker
    return json.loads(s)
           ^^^^^^^^^^^^^
  File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[E 2024-05-08 14:23:10.862 ServerApp] Uncaught exception in ZMQStream callback
    Traceback (most recent call last):
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 584, in _run_callback
        f = callback(*args, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 308, in stream_callback
        return callback(self, msg)
               ^^^^^^^^^^^^^^^^^^^
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 508, in handle_outgoing_message
        if self._limit_rate(channel, msg, parts):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 657, in _limit_rate
        msg["header"] = self.get_part("header", msg["header"], msg_list)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 524, in get_part
        value = self.session.unpack(msg_list[field2idx[field]])
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_client/session.py", line 124, in json_unpacker
        return json.loads(s)
               ^^^^^^^^^^^^^
      File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/__init__.py", line 346, in loads
        return _default_decoder.decode(s)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 337, in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 355, in raw_decode
        raise JSONDecodeError("Expecting value", s, err.value) from None
    json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[E 2024-05-08 14:23:10.864 ServerApp] Uncaught exception in zmqstream callback
    Traceback (most recent call last):
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 634, in _handle_events
        self._handle_recv()
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 663, in _handle_recv
        self._run_callback(callback, msg)
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 584, in _run_callback
        f = callback(*args, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 308, in stream_callback
        return callback(self, msg)
               ^^^^^^^^^^^^^^^^^^^
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 508, in handle_outgoing_message
        if self._limit_rate(channel, msg, parts):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 657, in _limit_rate
        msg["header"] = self.get_part("header", msg["header"], msg_list)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 524, in get_part
        value = self.session.unpack(msg_list[field2idx[field]])
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_client/session.py", line 124, in json_unpacker
        return json.loads(s)
               ^^^^^^^^^^^^^
      File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/__init__.py", line 346, in loads
        return _default_decoder.decode(s)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 337, in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 355, in raw_decode
        raise JSONDecodeError("Expecting value", s, err.value) from None
    json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Exception in callback BaseAsyncIOLoop._handle_events(47, 1)
handle: <Handle BaseAsyncIOLoop._handle_events(47, 1)>
Traceback (most recent call last):
  File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/asyncio/events.py", line 84, in _run
    self._context.run(self._callback, *self._args)
  File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/tornado/platform/asyncio.py", line 192, in _handle_events
    handler_func(fileobj, events)
  File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 634, in _handle_events
    self._handle_recv()
  File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 663, in _handle_recv
    self._run_callback(callback, msg)
  File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 584, in _run_callback
    f = callback(*args, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 308, in stream_callback
    return callback(self, msg)
           ^^^^^^^^^^^^^^^^^^^
  File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 508, in handle_outgoing_message
    if self._limit_rate(channel, msg, parts):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 657, in _limit_rate
    msg["header"] = self.get_part("header", msg["header"], msg_list)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 524, in get_part
    value = self.session.unpack(msg_list[field2idx[field]])
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_client/session.py", line 124, in json_unpacker
    return json.loads(s)
           ^^^^^^^^^^^^^
  File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I'll see if I can get the malformed JSON out of the browser debugger.