Member-only story

How to Fix the 'state' Key is Missing from 'metadata.widgets' Error in Jupyter Notebooks

3 min readApr 30, 2025

If you’ve ever tried to open or convert a Jupyter Notebook and encountered an error like:

you’re not alone. This error is relatively common, especially when working with notebooks that use interactive widgets (such as sliders or dropdowns from ipywidgets) and are later opened or rendered in a different environment.

Fortunately, this issue is easy to fix once you understand what’s going on.

🔍 What Causes the Error?

Jupyter Notebooks use a metadata section to store information about the notebook, including widget configurations. When you use interactive widgets in a notebook, Jupyter records their settings in a key called "widgets" within the metadata.

The error occurs when the widgets section exists but is missing the required "state" key. This could happen due to:

  • Saving the notebook in an older or incompatible environment.
  • Stripping metadata accidentally.
  • A glitch during widget embedding or rendering.

✅ Solution 1: Remove metadata.widgets (Quick and Safe)

--

--

No responses yet