NetHack generates an impossible message when something such as a monster or object reaches a state that it should not be possible to reach; it displays a short description of the problem, followed by "Program in disorder - perhaps you'd better #quit.". These messages are generated by the impossible() function in pline.c.
Some bugs in NetHack 3.4.3 generate impossible messages; for example, C343-33, "Sometimes a monster may remain hidden under a corpse that has rotted away.", can result in a player polymorphed into a hiding monster hiding under a non-existent object, generating the message "hiding under nothing?" when a monster tries to attack the polymorphed player.
If an error results in the session being unable to continue, the game will normally panic instead of issuing an impossible message.