Bug introduced in 10.4 or earlier and fixed in 11.2

I've found that NotebookImport[file,"Input" -> "HeldInterpretedCell"] doesn't seem to cope when the closing bracket of a command is on the following line of an input cell.

So if I save a notebook test.nb with the following input cell (as one cell):

Plot[x, {x, 0, 1}

Then NotebookImport["test.nb","Input" -> "HeldInterpretedCell"] gives a Failure[] box instead of the expected HoldComplete[Plot[x,{x,0,1}]].

With multiple different cells with different permutations:

Plot[x, {x, 0, 1}

Plot[x, {x, 0, 1}]

 {x, 0, 1}]

 {x, 0, 1}]

the first and last will fail, but the middle two are fine. It looks like it is related to the square brackets of the outmost command being the end/start of a line.

Is this a bug?

  • $\begingroup$ I'd say so, meanwhile you can probably use ideas from: Reading Cells or Boxes expression by expression $\endgroup$
    – Kuba
    May 19, 2017 at 12:47
  • $\begingroup$ I asked the question based on the answers in mathematica.stackexchange.com/questions/146167 sometimes giving errors, and traced it back to this. I can probably hack the part out of the Failure[] box that I need. $\endgroup$
    – SPPearce
    May 19, 2017 at 13:30
  • 2
    $\begingroup$ Not only "HeldInterpretedCell" but also "InterpretedCell" fails miserably. I think it is a bug, definitely worth reporting. $\endgroup$ May 19, 2017 at 14:30
  • 1
    $\begingroup$ With versions 11.0.1 and 10.4.1 I get the same failure for "HeldInterpretedCell" and "InterpretedCell" as with version 11.1.1. $\endgroup$ May 19, 2017 at 14:34
  • $\begingroup$ Bug submitted to Wolfram. $\endgroup$
    – SPPearce
    May 22, 2017 at 9:13

1 Answer 1


Wolfram Support emailed me to let me know that this has been fixed in v11.2, which I've confirmed.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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