Bug introduced in 12.3, Resolved in 13.1

I am using Windows 10 and found a bug concerning NotebookDirectory (and also NotebookInformation) in 12.3. It can be easily reproduced. Create a new notebook and save it as notebook1 in a folder, lets say c:\folder1\notebook1. As expected, excecuting NotebookDirectory[] gives


Now save the notebook and copy it (using the Explorer) into another folder named c:\folder2. Rename the copy to c:\folder2\notebook2.nb and open it in Mathematica, such that now both notebooks are open. (There is no need to excecute notebook2.nb, just open it) The bug is, that re-excecuting NotebookDirectory[] in notebook1.nb gives:


instead of again c:\folder1 :-( This is of course not correct. I tested this on two machines, and saw the bug on both. Also I assigned different kernels to the notebooks. It does not matter.

Also, after closing and reopening Mathematica: If I open notebook1 alone I get the correct notebook directory, if I also open notebook2, I get for notebook1 the wrong directory.

With Mathematica 12.2 I had the problem not. However,I cannot exclude that the bug appeared with the latest Windows update.

Any ideas, what is going on?

  • 5
    $\begingroup$ I reproduced this problem (12.3, Windows 10), with an additional problem - if I then close the second file (with or without executing anything), and try NotebookDirectory[] in the first file, I get an error: NotebookDirectory::nosv: The notebook NotebookObject[25501141-5cf3-49a4-916b-3b8b6fb97d14] is not saved. $\endgroup$
    – MelaGo
    Commented Jun 23, 2021 at 21:21
  • 2
    $\begingroup$ NotebookInformation[] reveals that both notebooks have identical ExpressionUUIDs. Is this the source of the problem? Or is this expected? I do not know what this ID is used for. $\endgroup$
    – dnet
    Commented Jun 24, 2021 at 8:36
  • 1
    $\begingroup$ Now I testet this with 12.2 on the same machine. No problem there. ExpressionUUIDs are identical there, too. $\endgroup$
    – dnet
    Commented Jun 24, 2021 at 8:42
  • 1
    $\begingroup$ As my colleagues and me copy notebooks containing NotebookDirectory[] rather commonly, we will go back to 12.2 for now. $\endgroup$
    – dnet
    Commented Jun 24, 2021 at 8:51
  • 7
    $\begingroup$ I reported the bug to Wolfram. $\endgroup$
    – dnet
    Commented Jun 24, 2021 at 9:01

2 Answers 2


I found an effective solution in this answer:


CurrentValue[$FrontEnd, FrontEnd`FrontEndObjectFormat] = "Legacy"

Thanks to josh and Kuba. In fact, we can find this "NotebookObject and CellObject now use a UUID string instead of specific FrontEndObject values" in incompatible changes of MMA. I think that's the problem.

  • $\begingroup$ I got the same hint from Wolfram support. And some hint that the issue might be solved in 13.1. Let's hope. $\endgroup$
    – dnet
    Commented May 10, 2022 at 8:46

Sorry I can't make any comment because of my reputation.

Try with SetDirectory[NotebookDirector[]] as first line of you codeflow and then use Directory[] instead.

I had a similar problem and It worked for me.

  • 2
    $\begingroup$ It doesn't work. You solution relies upun buggy NotebookDirectory[], and hence can't work reliably in principle. $\endgroup$ Commented Dec 9, 2021 at 4:14

Your Answer

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

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