4
$\begingroup$

Tested in

$Version
(* "14.3.0 for Microsoft Windows (64-bit) (July 8, 2025)" *)

The issue can be reproduced in the following manner. First, execute the following code:

BeginPackage["abc`"];
EndPackage[];
abc`Det;
Det[{{1, 2}, {3, 4}}]

Det[…] returns unevaluated, this is expected, of course.

Next, kill the kernel by e.g. executing

Exit

Then, restart the kernel, and execute

BeginPackage["abc`"];
EndPackage[];

Immediately, we see Det turns red (make sure the line Det[{{1, 2}, {3, 4}}] is in another cell). By checking e.g. ??*`Det, we see the abc`Det has been created.

The following is a GIF illustrating the issue:

enter image description here

What's happening here? Is this a bug or feature?


If you're wondering how I notice this, check what's inside the VectorAnalysis.m file by e.g.

FileNameJoin@{FindFile["VectorAnalysis`"] // DirectoryName // 
    ParentDirectory, "VectorAnalysis.m"} // SystemOpen

You'll see something interesting.

$\endgroup$
2
  • 1
    $\begingroup$ Domen has figured out what's happening in the chat: chat.stackexchange.com/transcript/message/68328459#68328459 Since this is never mentioned in the main site, I think it's worth making it a formal post. $\endgroup$ Commented Sep 30 at 1:33
  • 1
    $\begingroup$ It looks like then one needs to remove all output cells before exiting using FrontEndExecute[FrontEndToken["DeleteGeneratedCells"]]; then the earlier message with the dynamic content hidden inside that blue "!" is removed. i.sstatic.net/M6ddRn1p.png $\endgroup$ Commented Sep 30 at 3:11

1 Answer 1

7
$\begingroup$

This issue occurs because of the presence of the error message in the notebook. The error message contains dynamic content*, for example the little blue button with an i. When the kernel is restarted, the front end updates the dynamic content by calling the main kernel in order to obtain the link to the documentation of the error message:

FrontEnd`Private`messageDocsLink["abc`Det", "shdw"]

During the evaluation of this function, the symbol is recreated again. I can convince you with this simple code, which you should run in a fresh notebook and clean kernel.

?? abc`Det
(* Missing["UnknownSymbol", "abc`Det"] *)

FrontEnd`Private`messageDocsLink["abc`Det", "shdw"]
(* TemplateBox[{"paclet:ref/message/General/shdw"}, ] *)

?? abc`Det
(*  Symbol abc`Det. Full Name abc`Det *)

This means that if you first delete the cell containing the error message, the issue in question is not present.

enter image description here


* See CurrentValue[{StyleDefinitions, "MessageTemplate2"}].

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.