{"record":{"id":"20acab6ca16f4115","repo":"phacility/phabricator","slug":"this-jupyter-notebook-does-not-specify-any-noteboo","errorCode":null,"errorMessage":"This Jupyter notebook does not specify any notebook cells.","messagePattern":"This Jupyter notebook does not specify any notebook cells\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/files/document/PhabricatorJupyterDocumentEngine.php","lineNumber":349,"sourceCode":"    }\n\n    if ($nbformat !== 4) {\n      throw new Exception(\n        pht(\n          'This Jupyter notebook uses an unsupported version of the file '.\n          'format (found version %s, expected version 4).',\n          $nbformat));\n    }\n\n    $cells = idx($data, 'cells');\n    if (!is_array($cells)) {\n      throw new Exception(\n        pht(\n          'This Jupyter notebook does not specify a list of \"cells\".'));\n    }\n\n    if (!$cells) {\n      throw new Exception(\n        pht(\n          'This Jupyter notebook does not specify any notebook cells.'));\n    }\n\n    if (!$for_diff) {\n      return $cells;\n    }\n\n    // If we're extracting cells to build a diff view, split code cells into\n    // individual lines and individual outputs. We want users to be able to\n    // add inline comments to each line and each output block.\n\n    $results = array();\n    foreach ($cells as $cell) {\n      $cell_type = idx($cell, 'cell_type');\n      if ($cell_type === 'markdown') {\n        $source = $this->readString($cell, 'source');\n","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/files/document/PhabricatorJupyterDocumentEngine.php#L331-L367","documentation":"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.","triggerScenarios":"A v4 notebook containing exactly \"cells\": [] — e.g. scaffold notebooks from generators, or scripts that filtered out every cell before upload.","commonSituations":"Automated notebook templates that ship empty; cleaning scripts that remove cells (outputs) and end up removing all of them.","solutions":["Add at least one cell (markdown or code) to the notebook before uploading","Fix the generator so it does not emit or upload empty notebooks"],"exampleFix":"\"cells\": []\n\nafter:\n\"cells\": [\n  { \"cell_type\": \"markdown\", \"metadata\": {}, \"source\": [\"# Notebook\"] }\n]","handlingStrategy":"validation","validationCode":"$cells = idx($data, 'cells');\nif (is_array($cells) && count($cells) === 0) {\n  // empty notebook: nothing to render, skip or reject\n}","typeGuard":null,"tryCatchPattern":"catch Exception and skip rendering for empty notebooks instead of showing an error page.","preventionTips":["Do not emit or upload notebooks with zero cells","Treat empty-cell notebooks as scaffolding artifacts, not documents"],"tags":["jupyter","empty-collection","validation"],"backgroundTag":"invalid-jupyter-notebook","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}