Skip to content

ipywidgets.Output duplicates content after tab moved to new window #17354

@asemptote

Description

@asemptote

Environment data

  • VS Code version: 1.112.0
  • Jupyter Extension version (available under the Extensions sidebar): 2025.9.1
  • Python Extension version (available under the Extensions sidebar): 2026.4.0
  • OS (Windows | Mac | Linux distro) and version: Windows (WSL2, Linux 5.15.167.4-microsoft-standard-WSL2)
  • Python and/or Anaconda version: Python 3.12.3
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
  • Jupyter server running: Local

Expected behaviour

When a Jupyter notebook tab is moved to a new VS Code window, output that was previously displayed inside an ipywidgets.Output widget should appear exactly once in the new window.

Actual behaviour

After moving a notebook tab to a new VS Code window, new output generated inside an ipywidgets.Output widget (by interacting with the widget) is duplicated. This affects stream output (print()) and display output (IPython.display.display()). Output that existed before the move is not affected. out.outputs is () (empty) despite the widget displaying content, and the Jupyter output panel logs a CDN fetch error (see Logs).

Steps to reproduce:

  1. Open a Jupyter notebook in VS Code.
  2. Run the following cell:
import ipywidgets as widgets
from IPython.display import clear_output

out = widgets.Output()
button = widgets.Button(description="Click me")

def on_click(b):
    with out:
        clear_output(wait=True)
        print("hello")

button.on_click(on_click)
display(widgets.VBox([button, out]))
  1. Click the "Click me" button. The word hello appears once inside the widget.
  2. Drag the notebook tab into a new VS Code window.
  3. Click the "Click me" button again. The word hello now appears multiple times inside the widget.

Logs

Output for Jupyter in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Jupyter)

17:17:02.750 [error] Widget Error: Failed to access CDN https://unpkg.com/ after 0 attempt(s), TypeError: Failed to fetch

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions