You have a detached Mosh session on this server
What the detached-session notice means, why it appears, and how to end old Mosh sessions you no longer need.
When you start a Mosh session, the host can print a blue line at the top of the screen:
Mosh: You have a detached Mosh session on this server (mosh [12345]).
With several old sessions it reads "You have 3 detached Mosh sessions on this server, with PIDs:" and lists one line for each. This is a notice, not an error.
What it means
Every Mosh session has its own mosh-server process on the host. It keeps running until the client ends the session or a timeout stops it. A session is detached when its mosh-server is still running but no client is talking to it. The usual cause is closing the app or the client without ending the session, or losing the network for a long time.
On hosts that support it, each session is recorded in the host's login records (utmp). mosh-server marks the record as detached when it has not heard from the client for more than 30 seconds. When a new session starts, the host reads these records and prints the notice for every detached Mosh session of your user name. Sessions that are still connected are not listed. The number in brackets is the process ID of the old mosh-server.
It does not reattach
Starting mosh again always starts a new mosh-server and a new session. The new session does not take over the old one, so the notice does not mean your old screen is waiting for you. A session that was cut off by a network drop comes back on its own when the same client is still running and the network returns. See How long a Mosh session lasts.
To get your work back after you close the client, run the work inside a terminal multiplexer on the host. The Mosh usage page at mosh.org gives this form for screen:
mosh host -- screen -dr
Ending old sessions
Find the process IDs in the notice, or list them:
pgrep -u "$USER" mosh-server
SIGUSR1 always ends mosh-server unless the variable MOSH_SERVER_SIGNAL_TMOUT is set on the host. Only end sessions you know are detached:
kill -USR1 12345
If you do not want old sessions to pile up, set MOSH_SERVER_NETWORK_TMOUT on the host so a session ends after a set time without contact from the client. See How long a Mosh session lasts.