Fix Notebook Errors

VerifiedSafe

Diagnoses and resolves errors in Jupyter notebooks, including Python code bugs, JSON schema violations, and source library issues. It automatically removes problematic cell IDs and normalizes nbformat_minor to fix nbconvert failures. Useful when notebook execution fails due to code logic, missing imports, or invalid metadata.

Sby Skills Guide Bot
DevelopmentIntermediate
6/2/2026
Claude CodeCursorCopilotCodex
#fix-notebook#jupyter#debugging#json-schema#nbconvert

Recommended for

Automated summary

This skill handles fixing errors encountered during notebook execution, ranging from Python code bugs to Jupyter JSON schema violations and library issues.

Strengths

  • Accurate traceback analysis to pinpoint root causes
  • Direct edits to notebook cells or JSON schema
  • Multiple strategies: code, schema, or library source
  • Automated verification via nbconvert

Limitations

  • Does not cover deep business logic issues
  • May be limited by complex dependency chains
  • Source fixes might require recompilation
When to use it

Use this skill when a Jupyter notebook fails due to Python errors, invalid JSON schema, or bugs in underlying libraries.

When not to use it

Avoid this skill for general design problems or notebooks requiring a complete architectural rewrite.

Security analysis

Safe
Quality score85/100

The skill performs local file modifications (reading/writing .ipynb JSON) and running Jupyter commands for error-fixing. No destructive, exfiltrating, or obfuscated operations are present; it is a legitimate Jupyter maintenance task.

No concerns found

How this analysis is made

Examples

Fix JSON schema error
This notebook fails with 'Additional properties are not allowed ('id' was unexpected)'. Fix the JSON schema by removing cell IDs and setting nbformat_minor to 4.
Correct import error
The first cell in the notebook has an import error: ModuleNotFoundError for 'gwexpy'. Add a cell to install it via pip, or fix the import path.

name: fix_notebook description: ノートブックのエラーを、そのノートブック自体の修正(セル内容・JSONスキーマ)またはソースコードの修正により解決する

Fix Notebook Errors

This skill handles fixing errors encountered during notebook execution, ranging from Python code bugs to Jupyter JSON schema violations.

Instructions

  1. Analyze the Failure:

    • Examine the traceback to determine if the error is in the notebook cell's logic, a JSON schema violation, or the underlying library.
  2. Strategy A: Fix Code Cell (Local):

    • If the usage is wrong, imports are missing, or data paths are incorrect, edit the .ipynb cells.
    • Modify the "source" field of the failing code cell in the notebook JSON.
    • Unit-Safe Assignment: When updating astropy.units objects, prefer series.value[:] = new_data to keep metadata.
  3. Strategy B: Fix JSON Schema:

    • If nbconvert or validators fail with "Additional properties are not allowed ('id' was unexpected)":
    • Remove Cell IDs: Delete the "id" key from all cells in the JSON.
    • Normalize nbformat_minor: Set nbformat_minor to 4 (if nbformat is 4) to prevent auto-adding IDs.
  4. Strategy C: Fix Library Source Code:

    • If the bug is in the gwexpy/ package, trace it to the source file and apply the fix.
  5. Verification:

    • Re-run the notebook using jupyter nbconvert --execute or test_notebooks to confirm it passes.
# Utility for Strategy B
import json
def fix_nb_schema(path):
    with open(path, 'r') as f:
        data = json.load(f)
    for cell in data.get('cells', []):
        cell.pop('id', None)
    if data.get('nbformat') == 4 and data.get('nbformat_minor', 0) >= 5:
        data['nbformat_minor'] = 4
    with open(path, 'w') as f:
        json.dump(data, f, indent=1)

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/fix-notebook-errors-mmio71uk/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/fix-notebook-errors-mmio71uk' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/fix-notebook-errors-mmio71uk/download' --output '.skill-downloads/fix-notebook-errors-mmio71uk/SKILL.md.part' && mv '.skill-downloads/fix-notebook-errors-mmio71uk/SKILL.md.part' '.skill-downloads/fix-notebook-errors-mmio71uk/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

This file does not provide a usable name/description header for this native procedure. It remains available to download and inspect; use the manual method below.

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/fix-notebook-errors-mmio71uk/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills