Mathematica Notebook Corruption

Corrupt Notebook Symptoms

If you try to open a corrupt notebook, you might experience one of the following problems:

  • The front end hangs without responding.
  • The front end quits unexpectedly.
  • The display of the cells is incorrect.
  • Attempting to edit a cell causes the front end to hang without responding.
  • Attempting to edit a cell causes the front end to quit unexpectedly.

Preventing Notebook Corruption

There are two steps to prevent notebook corruption:

  1. Delete the Mathematica preferences file:
    rm ~/.Mathematica/3.0/FrontEnd/init.m
  2. Open notebooks while ignoring the file outline cache:
    From the File menu, select Open Special.
    From the resulting window, click OK to select the default settings (which should have "Ignore File Outline Cache" set).
    From the resulting dialog box, navigate your way to the notebook to open it while ignoring the file outline cache.

Restoring a Corrupt Notebook

You can use the Corruption package to extract all of the readable cells from a notebook:

  • First, load the package using the Get command:
  • Use the OpenCorruptedNotebook command to open the notebook. For example, if your notebook file is named corruptednotebook.nb, you would type:
  • This command reads in the cells from the notebook corruptednotebook.nb and puts them into a new untitled window. Bad cells are unformatted, given a cell tag of "junk", and stuck in red, bold, text cells.

The Corruption package is still in the experimental stage, so it might not work for every case.

If you are still experiencing problems, please let your instructor know. Keep a copy of the corrupted file, in case your instructor needs it.