Presenting as an illustrated tale, Fedora 40 edition:
$ ssh fedora-40
f40$ /usr/bin/emacs-29.4
(emacs-29-4:1862108): Gtk-WARNING **: 15:46:15.379: cannot open display:
f40$
Emacs, you had one job. ('emacs-29.4 -nw' works but should not necessary, emacs should get this right on its own and certainly used to.)