Skip to content

Jupyter API: A resolved server cannot be used on a notebook which had a server that was removed. NB controller disposed. #17094

@kevineger

Description

@kevineger

Environment data

  • VS Code version: 1.105.0
  • Jupyter Extension version (available under the Extensions sidebar): 2025.9.1
  • Python Extension version (available under the Extensions sidebar): 2025.16.0
  • OS (Windows | Mac | Linux distro) and version: Debian
  • Python and/or Anaconda version: N/A
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
  • Jupyter server running: Remote

Repro Steps

This bug report is in extending the Jupyter API. I've implemented a JupyterServerProvider which resolves remote servers.

  1. Open a new notebook.
  2. Create and resolve a new server from the JupyterServerProvider.
  3. Execute a code cell.
  4. Remove the server, firing the onDidChangeServers event for the JupyterServerProvider. provideJupyterServers now returns no servers.
  5. Observe that the kernel picker disconnects.
  6. Create and resolve a new server from the JupyterServerProvider.
  7. Execute a code cell.

Expected behaviour

The cell can be executed.

Actual behaviour

Nothing happens. The Notebook controller has been disposed. See logs below.

Investigation notes

  • If I don't execute a cell, which creates the session, (step 3 in repro) on the first server that gets removed, the bug doesn't repro.
  • Each time I execute a cell on the second server (step 7), Error: Cannot call start again is logged to the extension host output.
  • The only workaround is to re-load the file (which reconstructs the NB controller).

Logs

Jupyter

I've uploaded the Jupyter logs: jupyter-output-trace-logs.txt. To facilitate with debugging, I've separated the logs by the actions I took in the repro steps. The markers are:

  • ~~~ Start handleCommand to resolve a server
  • ~~~ Click on one of the kernels, as returned by the kernelspecs
  • ~~~ Successfully execute a cell
  • ~~~ Remove a server, which fires the onDidChangeServers event
  • ~~~ Resolve the second server
  • ~~~ Select a kernel
  • ~~~ Execute a cell

Ctrl+f for ~~~ should make jumping between the actions easier than perusing the verbose trace logs. Hope that helps with debugging!

Extension host

Each time the cell is executed on the second server (whose notebook controller is disposed), this message is emitted:

Error: Cannot call start again
    at Object.start (/usr/local/google/home/keger/.vscode-server/cli/servers/Stable-03c265b1adee71ac88f833e065f7bb956b60550a/server/out/vs/workbench/api/node/extensionHostProcess.js:201:28358)
    at iM.start (/usr/local/google/home/keger/.vscode-server/extensions/ms-toolsai.jupyter-2025.9.1-linux-x64/dist/extension.node.js:172:662)
    at /usr/local/google/home/keger/.vscode-server/extensions/ms-toolsai.jupyter-2025.9.1-linux-x64/dist/extension.node.js:309:94823
    at Array.forEach (<anonymous>)
    at n.executeQueuedCells (/usr/local/google/home/keger/.vscode-server/extensions/ms-toolsai.jupyter-2025.9.1-linux-x64/dist/extension.node.js:309:94793)
    at processTicksAndRejections (/usr/local/google/home/keger/src/colab-vscode/lib/internal/process/task_queues.js:105:5)
    at n.handleExecution (/usr/local/google/home/keger/.vscode-server/extensions/ms-toolsai.jupyter-2025.9.1-linux-x64/dist/extension.node.js:309:91402)
    at r4.$executeCells (file:///usr/local/google/home/keger/.vscode-server/cli/servers/Stable-03c265b1adee71ac88f833e065f7bb956b60550a/server/out/vs/workbench/api/node/extensionHostProcess.js:201:24241) {stack: 'Error: Cannot call start again
    at Object.…h/api/node/extensionHostProcess.js:201:24241)', message: 'Cannot call start again'}

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from poster

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions