phacility/phabricator · error · Exception

This Jupyter notebook does not specify any notebook cells.

Error message

This Jupyter notebook does not specify any notebook cells.

What it means

The 'cells' field is an array but contains zero elements. The engine treats a notebook with no cells at all as invalid and refuses to render an empty table. This is the last structural check in newCells() before the cells are used for rendering or diffing.

Source

Thrown at src/applications/files/document/PhabricatorJupyterDocumentEngine.php:349

    }

    if ($nbformat !== 4) {
      throw new Exception(
        pht(
          'This Jupyter notebook uses an unsupported version of the file '.
          'format (found version %s, expected version 4).',
          $nbformat));
    }

    $cells = idx($data, 'cells');
    if (!is_array($cells)) {
      throw new Exception(
        pht(
          'This Jupyter notebook does not specify a list of "cells".'));
    }

    if (!$cells) {
      throw new Exception(
        pht(
          'This Jupyter notebook does not specify any notebook cells.'));
    }

    if (!$for_diff) {
      return $cells;
    }

    // If we're extracting cells to build a diff view, split code cells into
    // individual lines and individual outputs. We want users to be able to
    // add inline comments to each line and each output block.

    $results = array();
    foreach ($cells as $cell) {
      $cell_type = idx($cell, 'cell_type');
      if ($cell_type === 'markdown') {
        $source = $this->readString($cell, 'source');

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Add at least one cell (markdown or code) to the notebook before uploading
  2. Fix the generator so it does not emit or upload empty notebooks

Example fix

"cells": []

after:
"cells": [
  { "cell_type": "markdown", "metadata": {}, "source": ["# Notebook"] }
]
Defensive patterns

Strategy: validation

Validate before calling

$cells = idx($data, 'cells');
if (is_array($cells) && count($cells) === 0) {
  // empty notebook: nothing to render, skip or reject
}

Try / catch

catch Exception and skip rendering for empty notebooks instead of showing an error page.

Prevention

When it happens

Trigger: A v4 notebook containing exactly "cells": [] — e.g. scaffold notebooks from generators, or scripts that filtered out every cell before upload.

Common situations: Automated notebook templates that ship empty; cleaning scripts that remove cells (outputs) and end up removing all of them.

Related errors


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/20acab6ca16f4115. Report an issue: GitHub.