papermill "PapermillExecutionError" in CI
papermill executes a notebook cell by cell and, unlike a silent run, writes the partially-executed output notebook so you can inspect it. When a cell raises, papermill records the error in that output and re-raises a PapermillExecutionError naming the cell index and the original exception.
What this error means
papermill exits non-zero with "papermill.exceptions.PapermillExecutionError" that reports the failing cell number, the exception type, and the original message.
papermill.exceptions.PapermillExecutionError:
---------------------------------------------------------------------------
Exception encountered at "In [4]":
KeyError: 'revenue'Common causes
A cell genuinely raised during execution
The notebook code failed for the given parameters or inputs: a bad key, a missing file, or a runtime error that surfaces in CI.
Wrong or missing parameters changed the code path
Parameters injected by papermill drove the notebook into a branch that errors, for example an empty or unexpected input value.
How to fix it
Open the saved output notebook
- Read the cell index named in the PapermillExecutionError.
- Open the output notebook papermill wrote to see the full traceback and the injected parameters cell.
- Fix the code or the parameters that drove the failing branch.
papermill input.ipynb output.ipynb -p region us-east -p threshold 10Validate parameters before the heavy cells
Add an early assertion cell so bad parameters fail fast with a clear message rather than deep in the notebook.
How to prevent it
- Archive the output notebook as a CI artifact so failures are inspectable.
- Assert on injected parameters early in the notebook.
- Test the notebook with representative parameters locally before CI.