Bug introduced in 12.0 or earlier and persisting through 13.1 or later

The bug is absent in Mathematica 8.0.4

I am not sure whether this has been addressed somewhere already, I couldn't find any comment.

I suffer from an annoying bug: when I copy and then paste a cell between grouped cells (forming eg a chapter), the grouping is destroyed (creating a new empty cell is fine). If there are several levels of nested groupings, all these groupings are mangled. This pretty quickly messes up any well-structured notebook.

This seems new for the Mathematica 12, 64 bit frontend for MacOS. However a precursor exists already for Mathematica 11: this happens eg if one deletes a cell and wants to reinstate it via undo.

Is there any way to get around this?


Alas, even in the new release 12.1.1 which supposedly has 1000 bug fixes, that one wasn't fixed. So it seems that the interest in fixing this is basically zero.

This is very unfortunate as the situation as it is now is so unworkable that it prevents me to upgrade to Mma 12, which in turn is a pre-condition to upgrade to macos Catalina. So all is stalled because of this.

I just checked the new Mma 12.2: even about 1.5 years after I submitted a bug report, and after 1000+ alleged bug fixes in 12.1, this one still wasn't fixed. I guess they won't do it. I am just wondering why they don't remove the "manual grouping" option for cells for good, as it is just not useable.

So, also in 12.3 this bug remains. After 1000+ bug fixes last year, and 1000+ bug fixes this year, this important one still has not been fixed.

  • 6
    $\begingroup$ If you can reproduce the bug, please report it to Wolfram directly. This is not a Wolfram site and mentioning it here won't ensure that it will get fixed. It is okay to ask for workarounds here, but even then it is important to explain very precisely how to reproduce the issue. If we cannot reproduce it, we won't be able to help. $\endgroup$
    – Szabolcs
    Commented Aug 6, 2019 at 7:54
  • 1
    $\begingroup$ @Szabolcs pretty sure this is a bug (at least on a Mac?) - try pasting a Cell/CellGroup inside any (manually-grouped) CellGroup. $\endgroup$ Commented Mar 25, 2020 at 3:49
  • 1
    $\begingroup$ @Szabolcs Done. $\endgroup$ Commented Mar 25, 2020 at 9:10
  • 1
    $\begingroup$ They didn't fix it. Again, after allegedly fixing thousands of bugs, and their repeated confirmation that this would be a high priority case, they didn't fix it after 2.5 years. I guess they will never do. $\endgroup$ Commented Dec 19, 2021 at 10:14
  • 1
    $\begingroup$ I have upgraded to mathematica 13.0 and the bug is still there. Deceiving ! $\endgroup$ Commented Dec 19, 2021 at 13:46

5 Answers 5


I reported this as a bug to support ~8 months ago and then logged it again in Redmine about 7 months ago (Bug #132) - it was one of the first things I noticed in 12.0's release. It was also documented on Wolfram Community around the same time.

The work-around is pretty unsatisfactory - basically save, close the notebook, open and then laboriously reconstruct all the nested cells just mangled (or wait until that organization is somewhat finalised to avoid repeating).

Aside: It surprises me that this bug has lasted so long given no real work-around and that nesting cells is a pretty fundamental activity for notebook organization. Perhaps it suggests that most users just don't use manual grouping? It so disrupted my workflow that I looked at reverting to automatic grouping while implementing hierarchical grouping via CellGroupingRules in stylesheets. This might have actually been a structural improvement as most of my CellGroups do have a natural hierarchy but unfortunately this approach doesn't seem to work sufficiently robustly for such a fundamental change (while also noting CellGroupingRules "has not been fully integrated into the long-term Wolfram Language, and is subject to change").


I have the same problem with Mathematica 12.0 and 12.1. As soon as you copy paste a cell or group of cells into an existing group of cells (I call it target-cell-group) the grouping is messed up. (see added pictures)

My workaround ist also not very nice: I create a new cell within the target-cell-group, and insert the cell/group of cells into this new cell. The grouping of the inserted cellgroup is gone of course, but at least the target-cell-group still exisists.

Anyway I will report this problem to wolfram this week. Let me know if someone has any solution for this problem.

Thanks a lot!

cells after inserting

cells before inserting


Wolfram is aware of the bug, and hopes it will be fixed:

"We hope that this issue will be resolved in future versions of Mathematica." -- Oct 9, 2020.

"Our developers are aware of the cell grouping issue and it is indeed a high priority one. I have passed all your comments to the report and conveyed the inconvenience you are experiencing." -- Oct 22, 2020.

Wolfram is aware that Mac users cannot roll back to v11 unless they are using rather old computers. I will not renew my Mathematica subscription until this bug is fixed. (The bug was introduced in 12.0 and remains in two variants of 12.1 and the recent 12.2. I suspect the front end has become too complex to maintain.)


The bug still thrives in v13.1.0 (at least, on Macs). For the curious, here is an easy way to demonstrate the problem from scratch: just copy the code below in a new Notebook (on a Mac), then follow the instructions further below.

makeCellGroup[sectionName_String, L:{__String}, k_Integer : 0] := 
  Block[{L2 = L, SN = sectionName},
   If[k > 0,
    SN = SN <> ToString[k];
    L2 = Map[# <> ToString[k] &, L]];
   CellGroup[{SN, CellGroup[L2]}]
makeTestNotebook[n_Integer] := Block[{cellGroups},
   cellGroups = 
    Map[makeCellGroup["Group #" <> ToString[#], {"A", "B"}] &,Range[n]];
   CreateDocument[cellGroups, CellGrouping -> Manual] // NotebookPut
  1. Evaluate the Notebook. A new Notebook will appear with 5 groups of cells.
  2. Select all cell groups ([CloverLeaf]A).
  3. Group all groups into a single group (^G).
  4. Select subGroup 3 by clicking on its vertical bar at the right edge.
  5. Cut (remove) the selected cell ([CloverLeaf]X).
  6. Paste (insert) it back where it was ([CloverLeaf]V).
  7. Notice that the group structure is broken: Instead of one group of nested cells there are 3 groups, and the lower group (#4 & #5) is topless! Click on the rightmost bottom bar to see a curious selection.
  8. The internal cell structure is now mangled. You may verify this by selecting everything ([CloverLeaf]A).
  9. Putting a mess like this back together is not trivial, especially when the cells are many and large!
  • $\begingroup$ I confirm the same problem with Mathematica 13.1.0 on Windows 10 x64. $\endgroup$ Commented Aug 7, 2022 at 3:30
  • $\begingroup$ The bug is absent in Mathematica 8.0.4 on Windows 10 x64. Hence it is a regression bug. $\endgroup$ Commented Aug 7, 2022 at 3:33
  • 1
    $\begingroup$ The bug was absent in Mathematica v11.3 and introduced in v12.0; so definitely a regression bug. If I could run v11.3 on my computer, I would happily downgrade. $\endgroup$ Commented Aug 7, 2022 at 22:47

I'm not seeing this for Mathematica 12.1 under macOS Catalina 10.15.3.

Can you post a specific notebook in which this happens and say what, if you copy from one section (chapter, or whatever) to another messes up the grouping?

  • $\begingroup$ That's also my set-up (12.1 Catallina 10.15.3). A notebook shouldn't be necessary; just try pasting a CellGroup inside any other CellGroup (with the notebook's Cell->Grouping style set to "Manual"). $\endgroup$ Commented Mar 25, 2020 at 23:15
  • $\begingroup$ Hello, first thing I checked in 12.1 was this bug and it is still there. I had asked Wolfram on a different channel back in December and got told that the bug won't be fixed in 12.1. This is annoying, as said, since I have amassed many hundreds of notebooks, as a daily user since 1991, often with sophisticated cell nesting patterns, and they all get mangled. To be sure: this applies to "Manual Grouping" only. And both to Mojave and Catalina. $\endgroup$ Commented Mar 26, 2020 at 9:06
  • $\begingroup$ See here a picture, don't know how to add the .nb here: gyazo.com/300b7f2da14dadba97326191369ad4ee $\endgroup$ Commented Mar 26, 2020 at 9:12
  • $\begingroup$ Best to avoid editing Mathematica notebooks outside the Mathematica front-end. Do it in the notebook while it is opened within Mathematica. To copy a single cell or a group of cells, just click on the corresponding cell bracket or the surrounding group bracket, respectively. $\endgroup$
    – murray
    Commented Mar 27, 2020 at 0:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.